
The files in your repository that tell an editor or a coding assistant what to run are now part of the attack surface, and most review processes do not treat them that way. A .vscode/tasks.json or a .claude/settings.json looks like configuration, but it can name commands that execute on a developer's machine. The ChainDrop npm worm planted exactly such files, and the vendor documentation shows that how much protection you get depends on the tool, its version and how it is launched. This post lays out what is documented, what is not, and how to put these files in scope for code review and penetration tests.
TL;DR
- ChainDrop did not only steal tokens. Using stolen GitHub credentials it wrote files into repositories so that editor or assistant activity would restart its payload later, turning one developer's compromise into a path to the next.
- VS Code gates this with Workspace Trust: in Restricted Mode, tasks prompt for trust, and automatic tasks do not run in an untrusted workspace. The gate is only as good as the trust decisions people make, including trusting a parent folder.
- Claude Code documents hooks in committed project settings. Its permission documentation, as we could read it, indicates that hooks are not gated by the folder trust dialog in some launch modes. We did not test this; see the caveats.
- Research on Model Context Protocol (MCP) clients found most evaluated clients lacked static validation of tool metadata, so the same trust gap shows up in tool definitions.
- Treat auto-executing config as code: review it in pull requests, restrict it with managed settings, and include it in developer-environment pentests.
What ChainDrop left behind
Microsoft's analysis of ChainDrop describes a self-propagating worm in more than 400 npm packages. Beyond republishing packages, it used stolen GitHub credentials to inject files into eligible repository branches: .claude/settings.json, .claude/setup.mjs, .vscode/tasks.json and .vscode/setup.mjs. Microsoft describes the effect as later Claude or VS Code activity restarting the payload after the npm install had finished, a secondary developer-to-developer infection path. It says the scope of that reach beyond the analysed samples is not stated.
Unit 42's analysis gives the mechanics. The .claude/settings.json file contains a SessionStart hook that runs a Node script, and .vscode/tasks.json defines a task named "Environment Setup" that runs on folder open. Unit 42 also reports an important limit: only the VS Code path reached an actual payload in the samples they analysed. So the files are a persistence design, and one of the two routes was incomplete in the sample. Neither report says that a particular assistant ran the hook without a prompt, and we have not tested that.
What the editor documentation says
VS Code is the clearest case, and its documentation describes a real control. Workspace Trust opens unfamiliar folders in Restricted Mode, which limits AI agents, the terminal, tasks, debugging, workspace settings and extensions. Running or even listing tasks from Restricted Mode shows a trust prompt. The tasks documentation states the risk plainly: someone could create a malicious task that anyone cloning the repository might unknowingly run. Our fetch of that page returned part of it as a summary, and the summary says automatic tasks have a separate setting, task.allowAutomaticTasks, that prompts once per workspace by default and never runs automatic tasks in an untrusted workspace. Check the live page before relying on those details.
The weak points are human. The Workspace Trust page says trusting a parent folder applies trust to all subfolders, so a developer who trusted a projects directory once has trusted every repository cloned into it. A control that depends on a one-time click on a parent folder is not a control a security team can assume is in force.
What the assistant documentation says
Claude Code's hooks reference describes hooks as user-defined commands that run automatically at points in the lifecycle. They can live in user settings, in .claude/settings.json that "can be committed to the repo", in a local file, in managed settings or in plugins. The SessionStart event fires when a session starts or resumes.
Whether a trust prompt stands in front of those hooks is the interesting question, and the documentation we read does not settle it for the interactive case. The settings documentation says permission allow rules and most environment values from project settings apply only after the folder is trusted. The security documentation describes a workspace trust dialog shown in interactive sessions in untrusted folders. The permissions documentation, as summarised by our fetch tool and not read verbatim, includes a table indicating that hooks in settings files are used even when only a parent folder is trusted and in non-interactive runs on a never-trusted folder. It lists no separate row for a brand-new folder in an interactive session, which is exactly why we flag the first-open behaviour as unverified. The practical reading is cautious: do not assume that a trust dialog is the only thing between a cloned repository and its hooks, particularly in automation.
Administrators do have a documented control. Managed settings can set allowManagedHooksOnly, which blocks user, project, local and plugin hooks, apart from plugin hooks force-enabled in managed settings. If your developers use this assistant, that setting belongs in the conversation about developer endpoints.
The same gap in MCP
The persistence story has a cousin on the tool side. In a March 2026 arXiv study of MCP threats, researchers at the New York Institute of Technology tested seven MCP clients against tool poisoning, where hidden instructions in a tool's description steer the model. The authors report that most clients, five of seven, did not implement static validation mechanisms. They also note that approval dialogs in some clients technically show all parameters but require horizontal scrolling to see complete values. Two caveats matter: the client testing is dated November 2025, so versions have moved on, and we could verify only part of the paper verbatim, so we do not repeat its per-client results. The authors' own scope excludes server-side and transport vulnerabilities, and our read of the paper found some internal inconsistencies in its tables.
The protocol itself speaks to the control. The MCP security best practices say clients supporting one-click local server configuration must implement consent before executing commands, showing the exact command and requiring explicit approval. The tools specification says clients must treat tool annotations as untrusted unless they come from trusted servers and recommends a human in the loop with the ability to deny invocations. A draft Cloud Security Alliance guide recommends hashing tool descriptions at registration and alerting on change; it is a draft with no named authors.
The common thread across worm persistence and tool poisoning is a file or a piece of metadata that a tool trusts by default and a human rarely reads.
What to scope in a developer-environment review
- Inventory auto-executing config in your repositories: editor task files with run-on-open behaviour, assistant hook definitions, MCP server definitions, and any setup scripts they reference.
- Require code-owner review on those paths, and make changes to them visible in pull requests rather than buried in a large diff.
- Check endpoint settings: Workspace Trust enabled, automatic tasks off, no broad parent folders marked trusted, and managed assistant settings where the product offers them.
- Test the launch modes, not just the interactive one. Ask whether automation, scripts or headless assistant runs behave differently from a developer's first open of a folder. Do this in a sandbox against a synthetic repository, and record exact versions.
- After any package incident, search repositories for these files and for unexpected recent commits to them.
- For MCP, pin and hash tool definitions where the client allows it, and make sure approval screens show full parameters.
None of this requires exploit code. It is an inventory, a review rule and a set of settings checks, followed by a controlled test of what actually runs on open.
The PentStark view
This section is opinion. We think these files should be reviewed with the same seriousness as a CI workflow, because they execute with a developer's privileges and often sit next to credentials. Vendors are moving in the right direction, and VS Code's trust model is a good example of a gate with sensible defaults. But a gate that depends on a human clicking through a prompt, or trusting a parent folder once, will fail eventually, and a scanner for tool descriptions will not find a hook that was added in a routine-looking commit. We would put developer environments into the scope of any supply-chain pentest and treat per-tool trust behaviour as something to test, not to assume from documentation. We hold this view with some uncertainty: we have not run these tools against a hostile repository for this post, and the documentation for the assistant is clearer about managed controls than about first-open behaviour. For background on how we scope this kind of work, see our methodology page.
References
- Microsoft Security: ChainDrop anatomy of a self-propagating worm
- Unit 42: ChainDrop npm worm analysis
- VS Code docs: Workspace Trust
- VS Code docs: Tasks
- Claude Code docs: Hooks reference
- Claude Code docs: Settings
- Claude Code docs: Security
- Claude Code docs: Permissions
- arXiv 2603.22489: MCP threat modeling and tool poisoning
- MCP: Security best practices
- MCP specification: Tools
- Cloud Security Alliance: Agentic MCP security best practices (draft)
Last verified: 2026-11-05
