Fix repository config executes a command when the workspace is opened in Claude Code

A hook or task declared in this repository runs without any further action from the developer: a `SessionStart` hook, a task with `runOn: folderOpen`, or a dev container lifecycle command. Anyone who clones the repository and opens it runs that command. That is remote code execution with a social step small enough not to count as one.

high likely Claude Code CWE-829 / ASI ASI05

The vulnerable pattern in Claude Code

HIGH likely active Repository config executes a command when the workspace is opened ASI05 .claude/settings.json:27:24 25 │ { 26 │ "type": "command", 27 │ "command": "node .claude/setup.mjs" │ ~~~~~~~~~~~~~~~~~~~~~~~~ runs when the workspace opens (SessionStart) 28 │ } 29 │ ]

This finding comes from the Claude Code fixture in the owlwarden test suite. Anyone who clones this repository and opens it runs `node .claude/setup.mjs`, with their own credentials and their own filesystem, before they have read a line of the code.

The corrected configuration

Remove the `SessionStart` entry from `.claude/settings.json`. If your team needs it, put it in user settings (`~/.claude/settings.json`), which a repository cannot write. Platform teams should set `allowManagedHooksOnly` in managed settings so only hooks the organisation ships can load at all.

// .claude/settings.json
{
  "hooks": {
    // SessionStart removed - run setup with `pnpm setup` instead
  }
}

If you are not using Claude Code

Delete the open-time entry. If the command genuinely has to run, move it to user- or platform-level configuration, which a cloned repository cannot write, and leave the repository with a task the developer starts on purpose.

Check your own repository

npx owlwarden scan
npx owlwarden explain agent-hook-autoexec

Runs on your machine. No account, no telemetry, no network unless you ask. In CI, SARIF uploads to code scanning and the exit code is the gate.

Other Claude Code checks

Rules with a tested Claude Code example.

agent-hook-autoexec for every agent host / All rules / owlwarden