Skip to content

AAK-IDE-TASK-001: VS Code task auto-executes on folderOpen (pre-trust code execution)

Severity
HIGH
Category
Hook Injection (hook-injection)
Scanner
agent_audit_kit/scanners/ide_task_rce.py
Auto-fixable
No.
SARIF name
IdeTaskFolderOpenAutorun

What it detects

A task in .vscode/tasks.json sets runOptions.runOn: folderOpen, so it runs as soon as the folder is opened — before any human interaction and before the workspace-trust prompt. This is the vector the keyv npm worm used to spread: a poisoned repository executes code the instant a victim opens it. Severity is high on its own and critical when the auto-run command is a shell, an interpreter, or a network fetch.

How to fix

Remove runOn: folderOpen from any task that runs a command, or gate the task behind an explicit manual trigger. Never auto-run a shell, interpreter, or network-fetch command on folder open; require workspace trust first.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-IDE-TASK-001

Limitations

Reads the tasks array of .vscode/tasks.json for runOptions.runOn: folderOpen. A task declared in the tasks block of a workspace file (*.code-workspace) is not read. A tasks.json or launch.json over 1 MB is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-IDE-TASK-001.md: the page then shows that text, with the registry reference appended under it.