Skip to content

Commit 525ced2

Browse files
quote archive names before extraction (#9165)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 9c4d159 commit 525ced2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/cli/src/config/extensions/github.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import * as fs from 'node:fs';
1717
import * as path from 'node:path';
1818
import { execSync } from 'node:child_process';
1919
import { loadExtension } from '../extension.js';
20+
import { quote } from 'shell-quote';
2021

2122
function getGitHubToken(): string | undefined {
2223
return process.env['GITHUB_TOKEN'];
@@ -401,10 +402,12 @@ async function downloadFile(url: string, dest: string): Promise<void> {
401402
}
402403

403404
function extractFile(file: string, dest: string) {
405+
const safeFile = quote([file]);
406+
const safeDest = quote([dest]);
404407
if (file.endsWith('.tar.gz')) {
405-
execSync(`tar -xzf ${file} -C ${dest}`);
408+
execSync(`tar -xzf ${safeFile} -C ${safeDest}`);
406409
} else if (file.endsWith('.zip')) {
407-
execSync(`unzip ${file} -d ${dest}`);
410+
execSync(`unzip ${safeFile} -d ${safeDest}`);
408411
} else {
409412
throw new Error(`Unsupported file extension for extraction: ${file}`);
410413
}

0 commit comments

Comments
 (0)