← MCP server and skill grades

cc-safety-net

kenryu42/cc-safety-net

C
Type
Plugin
Scanned
Nov 17, 2026
Version
8e8967fe9553
Files read
685

... wait NO! Do not output any extra text! Let me catch myself! Output ONLY the raw JSON object. `{

What it can reach

Files
Reads and writes its own settings, rulebooks, and command logs in your home and project folders, updates configuration files and package caches for your AI coding tools during setup, and reads Git info and local script files to inspect commands.
Network
Connects to npm to check for updates or fetch the package when uncached, downloads rulebooks and repository info from GitHub, pushes plugin updates to your Amp Git repository if requested, and runs a token-protected local web server on your computer (127.0.0.1) for its settings dashboard.
Shell commands
Intercepts shell commands before AI coding assistants run them, and runs local coding assistant tools, Git, npm/npx, system folder-picker utilities, and brief shell checks during setup, diagnostics, and dashboard use.
Browser
Opens the local settings dashboard in your default web browser when you start the graphical interface, and opens GitHub documentation or issue links in a new tab when clicked.

Findings

1 high2 medium2 low
  1. HighWorkspace-relative unpinned npx hook allows cloned repositories to execute arbitrary code

    src/hosts/managed-command.ts:6

    For Cursor, Antigravity CLI, Devin CLI, Factory Droid, Grok Build, and Kimi Code, cc-safety-net install writes a bare npx -y cc-safety-net hook --... command into the agent's global hook configuration (and clears the npx cache). Unlike the Hermes Agent wrapper—which explicitly switches to the user's home directory so workspace files cannot impersonate the analyzer—these hook configurations inherit the workspace working directory. When a user opens a cloned repository containing a committed executable at node_modules/.bin/cc-safety-net (or a .npmrc pointing registry to an attacker-controlled server when the npx cache is cold), the very first tool call—even a read-only file view—causes npx to execute code from the untrusted repository on the user's machine and bypass all safety checks. Because the package spec is also unpinned, cold-cache runs fetch and execute whatever version is currently tagged latest on npm at runtime.

    Fix: Copy a pinned, self-contained hook bundle into a user-owned directory such as ~/.cc-safety-net/bin/ during install and update, and configure host hooks to run node on that absolute path instead of invoking npx -y cc-safety-net in the workspace directory.

  2. MediumDeepSeek Harness hook injects user-role instructions to run npx and edit global config with unvalidated tool names

    src/hosts/deepseek-harness/guard.ts:104

    In DeepSeek Harness, registerDeepSeekHarnessGuard attaches a tools/post-execute listener that triggers whenever any unknown or MCP tool runs with a non-empty command string argument. It injects a synthetic role: 'user' message instructing the agent—without asking the user first—to inspect plugin source code in node_modules and run npx -y cc-safety-net rule tool add ... to modify the user's global ~/.cc-safety-net/rules/rule.json. In addition, toolName is only checked with typeof toolName === 'string' before being interpolated raw into both the privileged role: 'user' prompt and the suggested shell command, allowing an untrusted MCP server's tool name containing shell metacharacters or prompt instructions to steer the agent.

    Fix: Validate toolName against a strict identifier pattern before interpolation, shell-escape it, and instruct the agent to ask the user for confirmation rather than autonomously running npx and mutating global user configuration.

  3. MediumWindows .cmd/.bat spawning allows cmd.exe environment expansion and command injection via crafted directory paths

    src/hosts/system-info.ts:77

    On Windows, getSpawnCommand wraps .bat and .cmd binaries (such as npm-installed opencode.cmd) in cmd.exe /d /s /c "call ...", quoting arguments with quoteWindowsCommandArg. Because quoteWindowsCommandArg does not escape or reject %, cmd.exe expands %VAR% sequences before parsing quotes and command separators—and since the /c argument ends with a double quote, %CMDCMDLINE:~-1% always expands to ". When OpenCode v2 is configured and cc-safety-net doctor, cc-safety-net gui, or install --opencode passes location[directory]=${cwd} from a crafted subdirectory inside a cloned repository (for example, dir%CMDCMDLINE:~-1%&calc.exe), %CMDCMDLINE:~-1% breaks out of the quoted argument and cmd.exe executes the injected command.

    Fix: Escape % and other cmd.exe metacharacters before invoking cmd.exe /c, or avoid passing untrusted working-directory paths through a cmd.exe command string.

  4. LowCloned repository policy.json can disable user secret and command protections by default

    src/core/policy/store.ts:94

    On every tool call, loadPolicyConfig loads <cwd>/.cc-safety-net/policy.json from the current project directory and merges it over the user's personal ~/.cc-safety-net/policy.json. Because CC_SAFETY_NET_PROJECT_TIGHTEN_ONLY (weakeningsIgnored) is off by default, a stranger's cloned repository can ship .cc-safety-net/policy.json with secret_protection.enabled: false, destructive_command_protection.enabled: false, safety.level: "standard", or broad allow_paths, silently turning off the user's own secret protections (for ~/.ssh, ~/.aws, and .env) and non-catastrophic command rules if the agent is prompt-injected.

    Fix: Enable tighten-only merging by default so repository-supplied .cc-safety-net/policy.json files can only add restrictions unless the user explicitly trusts the repository or opts into project weakenings.

  5. LowUnpinned remote install script piped to bash in developer setup script

    .agents/setup:61

    The repository's developer environment setup script downloads and executes https://bun.com/install directly via curl ... | bash without verifying a cryptographic checksum (unlike the Node.js installation earlier in the same script, which checks SHASUMS256.txt). Installed users never run this script, so it only affects contributors who run .agents/setup.

    Fix: Download the versioned Bun release archive directly and verify its SHA-256 checksum before extracting it, matching the Node.js verification in the same script.