Skip to main content

SKY-D365 · Supply chain and agent configuration

Agent hook committed to the repository

High

CRITICAL when the command downloads and runs remote code (curl … | sh), decodes and runs a payload (base64 -d | sh), or runs a script disguised as another file type, such as node logo.png.

Coding agents such as Claude Code can run shell commands on events like "session started" or "before a file is edited". These hooks live in settings files such as .claude/settings.json. SKY-D365 reports a hook command that is committed to the repository, because it runs on the machine of everyone who opens the project with that agent.

Languages
Claude Code, Gemini CLI, Cursor and Codex settings files
Quality gate
Full scan: listed, not counted by the gate. Diff scan: fails the gate on its own. A CRITICAL hook fails a full scan too. A baseline scan treats the rule like a diff scan when the baseline's rule_coverage lists it.
Finding type
review
Catalog name
Agent hook command committed in the repository
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A pull request that adds a SessionStart hook gets code execution on every developer laptop that opens the repository in the agent, with that developer's credentials, without anyone running the project.

What Skylos flags

.claude/settings.json · JSONReported on line 8
{  "hooks": {    "SessionStart": [      {        "hooks": [          {            "type": "command",            "command": "bash .claude/hooks/bootstrap.sh"          }        ]      }    ]  }}

What Skylos leaves alone

.claude/settings.json · JSON
{  "hooks": {    "PreToolUse": [      {        "matcher": "Edit|Write|MultiEdit",        "hooks": [          {            "type": "command",            "command": "skylos hook pre-edit --client claude || exit 0"          }        ]      }    ]  }}

Why Skylos leaves it alone

This is a Skylos hook, as skylos setup writes it. Skylos recognises its own hooks by their exact command grammar; skylos agent install-hooks writes the absolute path of the skylos program you ran it with, which is accepted too when it is outside the repository and temp folders. Any other command, or extra text after it, is reported.

How Skylos decides

  1. Runs with --danger (and -a). The ca9 library reads the hooks in .claude/settings.json, .claude/settings.local.json, .gemini/settings.json, .cursor/hooks.json and .codex/hooks.json, anywhere in the scanned folder except dependency folders such as node_modules, .venv and site-packages. Codex's config.toml is read only for MCP servers and API base URLs, and Kiro's .kiro/settings/mcp.json only for MCP servers, never for hooks.
  2. Every hook with a command (or, for an http hook, its URL) becomes a finding. So do Claude settings that run a command (apiKeyHelper, awsAuthRefresh, awsCredentialExport, gcpAuthRefresh, otelHeadersHelper, and any top-level setting with "type": "command", such as statusLine) and Gemini's tool discovery and tool call commands (tools.discoveryCommand, tools.callCommand, toolDiscoveryCommand, toolCallCommand).
  3. Keeps regular files inside the scanned folder, plus, when the scan is of a subfolder of a Git repository, the repository's top-level agent settings. In Git, a full scan keeps tracked files and untracked files Git does not ignore; a diff scan keeps tracked files that changed. Outside Git every file counts.
  4. Skips hooks Skylos wrote itself: the whole command must be skylos hook <event> --client claude|codex|cursor for one of Skylos's hook events, optionally followed by one of its fixed fallbacks such as || exit 0. The program may be skylos or an absolute path outside the repository and temp folders, made only of letters, digits and _ . + @ ~ -. The settings file must parse as plain JSON (no comments) and must not change PATH or similar variables in its env.
  5. Takes the severity from ca9: HIGH, or CRITICAL for remote code, decode-and-run payloads and disguised scripts. The command is shown redacted, because hooks can carry tokens.
  6. In the gate, a full scan lists HIGH findings without counting them; a CRITICAL one counts as a critical issue and fails. In a diff scan a hook is new when its rule, file and a digest of its event and whole command are not among the merge base's findings, whatever lines moved, and a new hook fails the gate on its own. A --baseline run behaves like a diff for the rules its baseline's rule_coverage lists.

How to fix it

Remove hooks that are not needed for everyone. If the team relies on one, keep the command short, point it at a reviewed script in the repository, and review both the command and the script in every change. Personal hooks belong in .claude/settings.local.json, ignored by Git.

Fix · Text
# .gitignore.claude/settings.local.json

When it can be wrong

  • Every committed hook is reported, however harmless: a formatter run after edits, a status line, an API-key helper.
  • A Skylos hook is still reported when the settings file has // comments, the skylos program lives inside the repository (for example .venv/bin/skylos), or the command is python -m skylos.entry.
  • Settings in example or template folders, and an untracked settings.local.json that Git does not ignore, are reported too.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Skylos reads no inline marker for this rule, even in settings files that allow comments.

  • Accept a reviewed hook with a baseline: skylos baseline ., then --baseline. The entry matches the rule, file, event and command, not the line, so it survives edits elsewhere in the file and checkout moves. In pull-request CI (SKYLOS_POLICY_BASE), the entry must also be in the base commit's .skylos/baseline.json.

  • [tool.skylos] ignore = ["SKY-D365"] turns the rule off for the whole project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.