From 27ce2b5a8f8cd5679d06d03005bb07b001db2798 Mon Sep 17 00:00:00 2001 From: bunnysayzz Date: Wed, 22 Jul 2026 10:29:48 +0530 Subject: [PATCH 1/2] fix: expand destructive-command blocklist to prevent security bypasses ## Summary\n\nThe existing `isCriticalCommand` blocklist was incomplete, allowing dangerous commands to auto-execute in headless/auto mode.\n\n## Changes\n\n- **Added dangerous paths:** /home, /root, /Users/mdazharuddin, /Users/mdazharuddin to both the recursive-deletion path check and the explicit `rm` critical paths list\n- **Added find -delete:** Detects destructive find commands with -delete flag\n- **Added shred/wipefs:** File-shredding and filesystem-wiping commands now blocked\n- **Added pkexec:** Privilege escalation via PolicyKit now blocked\n- **Shell expansion:** Added /Users/mdazharuddin pattern to catch variable-expansion bypasses\n\nCloses #13001 --- .../src/evaluateTerminalCommandSecurity.ts | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/terminal-security/src/evaluateTerminalCommandSecurity.ts b/packages/terminal-security/src/evaluateTerminalCommandSecurity.ts index 693eef25f9c..d763f8e3b22 100644 --- a/packages/terminal-security/src/evaluateTerminalCommandSecurity.ts +++ b/packages/terminal-security/src/evaluateTerminalCommandSecurity.ts @@ -428,10 +428,17 @@ function isCriticalCommand(baseCommand: string, args: string[]): boolean { arg === "/etc" || arg === "/bin" || arg === "/sbin" || + arg === "/home" || + arg === "/root" || + arg === "$HOME" || arg.startsWith("/usr/") || arg.startsWith("/etc/") || arg.startsWith("/bin/") || - arg.startsWith("/sbin/"), + arg.startsWith("/sbin/") || + arg.startsWith("/home/") || + arg.startsWith("/root/") || + arg.startsWith("$HOME") || + arg.startsWith("${HOME}"), ); // If we have rm flags with dangerous paths, it's critical regardless of command @@ -457,6 +464,10 @@ function isCriticalCommand(baseCommand: string, args: string[]): boolean { "/usr/sbin/", "/lib/", "/lib64/", + "/home/", + "/root/", + "$HOME", + "${HOME}", ]; if (args.some((arg) => criticalPaths.some((path) => arg.includes(path)))) { return true; @@ -492,6 +503,24 @@ function isCriticalCommand(baseCommand: string, args: string[]): boolean { } } + // Find -delete (destructive file deletion via find) + if (baseCommand === "find" && args.some((arg) => arg === "-delete")) { + return true; + } + + // Destructive disk/file commands + if ( + baseCommand === "shred" || + baseCommand === "wipefs" + ) { + return true; + } + + // pkexec privilege escalation + if (baseCommand === "pkexec") { + return true; + } + // Privilege escalation const privEscCommands = ["sudo", "su", "doas", "runas", "gsudo", "psexec"]; if (privEscCommands.includes(baseCommand)) { From 846a2fa01e78de5dd72b6e1dd5c34dac9636b512 Mon Sep 17 00:00:00 2001 From: bunnysayzz Date: Wed, 22 Jul 2026 10:41:20 +0530 Subject: [PATCH 2/2] fix: register viewLogs command before dynamic import to prevent startup failure ## Summary\n\nWhen extension activation fails (e.g., due to module load errors), the "View Logs" button in the error dialog does nothing because `continue.viewLogs` is registered inside the dynamically imported `activate.ts`. If the dynamic import fails, the command is never registered.\n\n## Fix\n\nRegistered `continue.viewLogs` directly in `extension.ts` before the dynamic import call, ensuring the command is always available regardless of whether the full extension activation succeeds.\n\nCloses #12946 --- extensions/vscode/src/extension.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/vscode/src/extension.ts b/extensions/vscode/src/extension.ts index 4712ebc4226..f3da5121d9a 100644 --- a/extensions/vscode/src/extension.ts +++ b/extensions/vscode/src/extension.ts @@ -14,6 +14,14 @@ async function dynamicImportAndActivate(context: vscode.ExtensionContext) { } export function activate(context: vscode.ExtensionContext) { + // Register viewLogs command early so it's available even if + // the dynamic import/activation fails. + context.subscriptions.push( + vscode.commands.registerCommand("continue.viewLogs", () => { + vscode.commands.executeCommand("workbench.action.toggleDevTools"); + }), + ); + return dynamicImportAndActivate(context).catch((e) => { console.log("Error activating extension: ", e); vscode.window