From 525ced295c4199c51bdd50a04dd18c74f2a88529 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Mon, 22 Sep 2025 15:35:45 -0700 Subject: [PATCH] quote archive names before extraction (#9165) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/cli/src/config/extensions/github.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/config/extensions/github.ts b/packages/cli/src/config/extensions/github.ts index f1e9a65bc4..ae2ec9077d 100644 --- a/packages/cli/src/config/extensions/github.ts +++ b/packages/cli/src/config/extensions/github.ts @@ -17,6 +17,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { execSync } from 'node:child_process'; import { loadExtension } from '../extension.js'; +import { quote } from 'shell-quote'; function getGitHubToken(): string | undefined { return process.env['GITHUB_TOKEN']; @@ -401,10 +402,12 @@ async function downloadFile(url: string, dest: string): Promise { } function extractFile(file: string, dest: string) { + const safeFile = quote([file]); + const safeDest = quote([dest]); if (file.endsWith('.tar.gz')) { - execSync(`tar -xzf ${file} -C ${dest}`); + execSync(`tar -xzf ${safeFile} -C ${safeDest}`); } else if (file.endsWith('.zip')) { - execSync(`unzip ${file} -d ${dest}`); + execSync(`unzip ${safeFile} -d ${safeDest}`); } else { throw new Error(`Unsupported file extension for extraction: ${file}`); }