Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions extensions/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down
Loading