cc-safety-net-dev
A pre-execution guard for AI coding agents. It blocks destructive Git and file system commands, plus common attempts to access sensitive files, before a tool call runs. Supports Amp Code, Antigravity CLI, Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, Grok Build, Hermes Agent, Kimi Code, OpenClaw, OpenCode, and Pi.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026. Its scripts were only partly scanned.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/kenryu42/cc-safety-net with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/kenryu42/cc-safety-net'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/kenryu42-cc-safety-net)HTML
<a href="/listings/kenryu42-cc-safety-net"><img src="/api/listings/kenryu42-cc-safety-net/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
You need Node.js 18 or higher. Install into the coding CLIs on this machine, then check that protection is working:
npx -y cc-safety-net@latest install npx -y cc-safety-net@latest doctor
Update with `npx -y cc-safety-net@latest update` and uninstall with `npx -y cc-safety-net uninstall`. Keep the `@latest` qualifier: a bare `cc-safety-net` spec can run an older copy from the npx cache. Per-CLI requirements are in [Installation](https://ccsafetynet.com/docs/installation).
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/marketplace.json · Manifest · 22 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- {
- "name": "cc-safety-net-dev",
- "metadata": {
- "description": "Development marketplace for cc safety net plugin",
- "version": "1.0.0"
- },
- "owner": {
- "name": "J Liew",
- "email": "jliew@420024lab.com"
- },
- "plugins": [
- {
- "name": "cc-safety-net",
- "description": "Block destructive commands and secret access",
- "source": "./",
- "author": {
- "name": "J Liew",
- "email": "jliew@420024lab.com"
- }
- }
- ]
- }
README.md · README · 125 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- <h1>
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="./.github/assets/cc-safety-net-header-logo-dark.svg">
- <source media="(prefers-color-scheme: light)" srcset="./.github/assets/cc-safety-net-header-logo-light.svg">
- <img alt="CC Safety Net" src="./.github/assets/cc-safety-net-header-logo-light.svg">
- </picture>
- </h1>
- [](https://github.com/kenryu42/cc-safety-net/actions/workflows/ci.yml)
- [](https://codecov.io/github/kenryu42/cc-safety-net)
- [](https://github.com/kenryu42/cc-safety-net)
- 
- 
- 
- [](https://opensource.org/licenses/MIT)
- <div align="center">
- **English** · [简体中文](https://ccsafetynet.com/docs/zh-Hans) · [日本語](https://ccsafetynet.com/docs/ja)
- https://github.com/user-attachments/assets/353c1441-9156-483c-b8e5-32fce7905a83
- </div>
- CC Safety Net (Coding CLI Safety Net) blocks destructive commands and access to secrets such as SSH keys and `.env` files before the tool call runs. It parses what the command does. Wrapping the command or reordering flags does not hide it. A broken config file falls back to safe defaults instead of stopping your agent. It is not a sandbox: it does not contain processes, set filesystem permissions, or watch network egress.
- > [!NOTE]
- > **[Full documentation →](https://ccsafetynet.com/docs)** covers installation, configuration, reference material, guides, and the security model. This README is the short version.
- ## Sponsors
- <p><sub><a href="https://ccsafetynet.com/sponsor">Want to appear here? →</a></sub></p>
- <br>
- <details open>
- <summary>Our sponsors</summary>
- <br>
- <p>
- <a href="https://ccsafetynet.com/go/crazyrouter?from=readme"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/crazyrouter-logo-dark.png"><source media="(prefers-color-scheme: light)" srcset="./.github/assets/crazyrouter-logo-light.png"><img alt="Crazyrouter" src="./.github/assets/crazyrouter-logo-light.png" height="32"></picture></a>
- <br>
- <sub><a href="https://ccsafetynet.com/go/crazyrouter?from=readme">One API for 300+ AI models, OpenAI‑compatible.</a></sub>
- <img src="https://ccsafetynet.com/go/crazyrouter/view?from=readme" alt="" width="1" height="1">
- </p>
- <br>
- <p>
- <a href="https://ccsafetynet.com/go/deepsider?from=readme"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/deepsider-logo-dark.png"><source media="(prefers-color-scheme: light)" srcset="./.github/assets/deepsider-logo-light.png"><img alt="DeepSider API" src="./.github/assets/deepsider-logo-light.png" height="32"></picture></a>
- <br>
- <sub><a href="https://ccsafetynet.com/go/deepsider?from=readme">One-stop access to leading global models such as GPT, Claude, Gemini, and DeepSeek. We use official channels from major providers — no account pools, no reverse engineering. Pricing as low as 29% of official rates. Real-time usage monitoring with transparent billing and clear usage, helping you call AI easily at lower cost.</a></sub>
- <img src="https://ccsafetynet.com/go/deepsider/view?from=readme" alt="" width="1" height="1">
- </p>
- </details>
- ## How it works
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="./.github/assets/how-it-works-dark.svg">
- <source media="(prefers-color-scheme: light)" srcset="./.github/assets/how-it-works-light.svg">
- <img alt="An AI coding agent tries to run a command or open a file. CC Safety Net checks what it would actually do before it runs. Safe calls such as git status run normally; dangerous ones such as git reset --hard never run, and the agent is told why." src="./.github/assets/how-it-works-light.svg" width="720">
- </picture>
- </p>
- ## Supported coding CLIs
- CC Safety Net supports these coding agent CLIs on Windows, macOS, and Linux.
- <table align="center">
- <tr>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/amp-code"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/amp-dark.svg"><img alt="Amp Code" src="./.github/assets/amp-light.svg" height="32"></picture><br>Amp Code</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/antigravity-cli"><img alt="Antigravity CLI" src="./.github/assets/antigravity-cli.png" height="32"><br>Antigravity CLI</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/claude-code"><img alt="Claude Code" src="./.github/assets/claude-code.svg" height="32"><br>Claude Code</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/codex"><img alt="Codex" src="./.github/assets/codex.svg" height="32"><br>Codex</a></td>
- </tr>
- <tr>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/cursor-dark.svg"><img alt="Cursor" src="./.github/assets/cursor-light.svg" height="32"></picture><br>Cursor</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/deepseek-harness"><img alt="DeepSeek Harness" src="./.github/assets/deepseek.svg" height="32"><br>DeepSeek Harness</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/devin-cli"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/devin-dark.svg"><img alt="Devin CLI" src="./.github/assets/devin-light.svg" height="32"></picture><br>Devin CLI</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/factory-droid"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/droid-dark.svg"><img alt="Factory Droid" src="./.github/assets/droid-light.svg" height="32"></picture><br>Factory Droid</a></td>
- </tr>
- <tr>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/gemini-cli"><img alt="Gemini CLI" src="./.github/assets/gemini-cli.svg" height="32"><br>Gemini CLI</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/github-copilot-cli"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/copilot-cli-dark.svg"><img alt="GitHub Copilot CLI" src="./.github/assets/copilot-cli-light.svg" height="32"></picture><br>GitHub Copilot CLI</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/grok-build"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/grok-build-dark.svg"><img alt="Grok Build" src="./.github/assets/grok-build-light.svg" height="32"></picture><br>Grok Build</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/hermes-agent"><img alt="Hermes Agent" src="./.github/assets/hermes.png" height="32"><br>Hermes Agent</a></td>
- </tr>
- <tr>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/kimi-code"><img alt="Kimi Code" src="./.github/assets/kimi-cli.png" height="32"><br>Kimi Code</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/openclaw"><img alt="OpenClaw" src="./.github/assets/openclaw.png" height="32"><br>OpenClaw</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/opencode"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/opencode-dark.svg"><img alt="OpenCode" src="./.github/assets/opencode-light.svg" height="32"></picture><br>OpenCode</a></td>
- <td align="center"><a href="https://ccsafetynet.com/docs/installation/pi"><img alt="Pi" src="./.github/assets/pi.svg" height="32"><br>Pi</a></td>
- </tr>
- </table>
- ## Features
- - **Blocks destructive commands** such as `git reset --hard`, `git push --force`, and `rm -rf` on dangerous targets, and install scripts piped from the internet (`curl … | bash`), even inside `bash -c` or `python -c`. See [Blocked commands](https://ccsafetynet.com/docs/reference/blocked-commands).
- - **Blocks secret access** to SSH keys, `.env` files, `~/.aws`, and coding-CLI credentials, from the shell and from the agent's file tools. See [Secret protection](https://ccsafetynet.com/docs/reference/secret-protection).
- - **Tunes the policy in a GUI.** Run `npx cc-safety-net gui` to pick the Standard, Strict, or Paranoid preset and turn rules on or off. See [Dashboard](https://ccsafetynet.com/docs/guides/dashboard).
- - **Adds blocks through rulebooks**: official packs for Terraform, AWS, gcloud, and Azure, or your own JSON. See [Official rulebooks](https://ccsafetynet.com/docs/configuration/rulebooks).
- - **Shares policy through git.** Commit `.cc-safety-net/` so clones and cloud sessions get the same rules. See [Team setup](https://ccsafetynet.com/docs/guides/team-setup).
- - **Embeds in your own tools.** Call `checkCommand` from Node.js without installing the hook. See [Library API](https://ccsafetynet.com/docs/reference/library-api).
- ## Quick start
- You need Node.js 22 or higher. Install into the coding CLIs on this machine, then check that protection is working:
- ```bash
- npx -y cc-safety-net@latest install
- npx -y cc-safety-net@latest doctor
- ```
- Update with `npx -y cc-safety-net@latest update` and uninstall with `npx -y cc-safety-net uninstall`. Keep the `@latest` qualifier: a bare `cc-safety-net` spec can run an older copy from the npx cache. Per-CLI requirements are in [Installation](https://ccsafetynet.com/docs/installation).
- ## Development
- See [CONTRIBUTING.md](CONTRIBUTING.md) to report a bug or request a feature.
- ## License
- MIT
src/cli/commands/explain.ts · Bundled script · 34 lines · 1 finding marked
- import type { Command } from './types';
- export const explainCommand = {
- name: 'explain' as const,
- description: 'Show step-by-step analysis trace of how a command would be analyzed',
- usage: 'explain [options] <command>',
- argument: '<command>',
- options: [
- {
- flags: '--json',
- description: 'Output analysis as JSON',
- },
- {
- flags: '--cwd',
- argument: '<path>',
- description: 'Use custom working directory',
- },
- {
- flags: '--shell',
- argument: '<auto|posix|powershell>',
- description: 'Parse the command as this shell (default: auto)',
- },
- {
- flags: '-h, --help',
- description: 'Show this help',
- },
- ],
- examples: [
- 'cc-safety-net explain "git reset --hard"',
- 'cc-safety-net explain --json "rm -rf /"',
- Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
- Line 30 on GitHub
- 'cc-safety-net explain --cwd /tmp "git status"',
- "cc-safety-net explain --shell posix 'rmdir /s /q d:\\'",
- ],
- } satisfies Command;
src/core/rules/destructive.ts · Bundled script · 660 lines · 4 findings marked
- import type { BlockIntent } from '@/core/decision';
- import type { RuleActivationCapability } from '@/core/rules/types';
- interface DestructiveCommandRuleMetadata {
- id: string;
- category: string;
- label: string;
- description: string;
- example: string;
- intent: BlockIntent;
- catastrophic?: true;
- activationCapability?: RuleActivationCapability;
- }
- const DESTRUCTIVE_COMMAND_RULE_DEFINITIONS = [
- {
- id: 'git.ssh-env',
- category: 'Git',
- label: 'Git SSH environment override',
- description: 'Blocks Git network operations with SSH environment overrides.',
- example: 'GIT_SSH_COMMAND="./ssh-wrapper" git push',
- intent: 'manual_only',
- },
- {
- id: 'git.alias-config',
- category: 'Git',
- label: 'Git command-line alias',
- description: 'Blocks command-line Git aliases that cannot be safely resolved.',
- example: "git -c alias.wipe='!rm -rf /' wipe",
- Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
- Line 29 on GitHub
- intent: 'manual_only',
- },
- {
- id: 'git.checkout-force',
- category: 'Git',
- label: 'Git checkout force',
- description: 'Blocks forced checkout operations that discard local changes.',
- example: 'git checkout --force main',
- intent: 'use_alternative',
- },
- {
- id: 'git.checkout-double-dash',
- category: 'Git',
- label: 'Git checkout path restore',
- description: 'Blocks checkout path restores, with or without --.',
- example: 'git checkout -- src/app.ts',
- intent: 'use_alternative',
- },
- {
- id: 'git.checkout-ref-path',
- category: 'Git',
- label: 'Git checkout ref and path',
- description: 'Blocks checkout forms that mix a ref and path restore.',
- example: 'git checkout HEAD -- src/app.ts',
- intent: 'use_alternative',
- },
- {
- id: 'git.checkout-pathspec-from-file',
- category: 'Git',
- label: 'Git checkout pathspec file',
- description: 'Blocks checkout pathspec loading from a file.',
- example: 'git checkout --pathspec-from-file=paths.txt',
- intent: 'use_alternative',
- },
- {
- id: 'git.checkout-ambiguous',
- category: 'Git',
- label: 'Git checkout ambiguous targets',
- description: 'Blocks ambiguous checkout arguments that may restore paths.',
- example: 'git checkout main src/app.ts',
- intent: 'use_alternative',
- },
- {
- id: 'git.switch-discard-changes',
- category: 'Git',
- label: 'Git switch discard changes',
- description: 'Blocks branch switches that explicitly discard local changes.',
- example: 'git switch --discard-changes main',
- intent: 'use_alternative',
- },
- {
- id: 'git.switch-force',
- category: 'Git',
- label: 'Git switch force',
- description: 'Blocks forced branch switches.',
- example: 'git switch --force main',
- intent: 'use_alternative',
- },
- {
- id: 'git.restore-worktree',
- category: 'Git',
- label: 'Git restore worktree',
- description: 'Blocks worktree restore operations.',
- example: 'git restore --worktree src/app.ts',
- intent: 'use_alternative',
- },
- {
- id: 'git.restore-unstaged',
- category: 'Git',
- label: 'Git restore unstaged',
- description: 'Blocks unstaged restore operations.',
- example: 'git restore src/app.ts',
- intent: 'use_alternative',
- },
- {
- id: 'git.reset-hard',
- category: 'Git',
- label: 'Git reset hard',
- description: 'Blocks hard resets.',
- example: 'git reset --hard',
- intent: 'use_alternative',
- },
- {
- id: 'git.reset-merge',
- category: 'Git',
- label: 'Git reset merge',
- description: 'Blocks merge resets.',
- example: 'git reset --merge',
- intent: 'use_alternative',
- },
- {
- id: 'git.clean-force',
- category: 'Git',
- label: 'Git clean force',
- description: 'Blocks forced clean operations.',
- example: 'git clean -fd',
- intent: 'use_alternative',
- },
- {
- id: 'git.rm-force',
- category: 'Git',
- label: 'Git rm force',
- description: 'Blocks forced removal of tracked files from the working tree.',
- example: 'git rm -rf .',
- intent: 'use_alternative',
- },
- {
- id: 'git.push-force',
- category: 'Git',
- label: 'Git push force',
- description: 'Blocks force pushes.',
- example: 'git push --force origin main',
- intent: 'use_alternative',
- },
- {
- id: 'git.push-delete',
- category: 'Git',
- label: 'Git push delete',
- description: 'Blocks remote ref deletion through push.',
- example: 'git push --delete origin old-branch',
- intent: 'manual_only',
- },
- {
- id: 'git.push-mirror',
- category: 'Git',
- label: 'Git push mirror',
- description: 'Blocks mirror pushes that can force-update or delete remote refs.',
- example: 'git push --mirror origin',
- intent: 'manual_only',
- },
- {
- id: 'git.branch-force-delete',
- category: 'Git',
- label: 'Git branch force delete',
- description: 'Blocks forced branch deletion.',
- example: 'git branch -D old-branch',
- intent: 'use_alternative',
- },
- {
- id: 'git.rebase-abort',
- category: 'Git',
- label: 'Git rebase abort',
- description: 'Blocks rebase abort operations.',
- example: 'git rebase --abort',
- intent: 'use_alternative',
- },
- {
- id: 'git.merge-abort',
- category: 'Git',
- label: 'Git merge abort',
- description: 'Blocks merge abort operations.',
- example: 'git merge --abort',
- intent: 'use_alternative',
- },
- {
- id: 'git.tag-delete',
- category: 'Git',
- label: 'Git tag delete',
- description: 'Blocks tag deletion.',
- example: 'git tag --delete v1.0.0',
- intent: 'manual_only',
- },
- {
- id: 'git.reflog-delete',
- category: 'Git',
- label: 'Git reflog delete',
- description: 'Blocks reflog deletion.',
- example: 'git reflog delete HEAD@{1}',
- intent: 'manual_only',
- },
- {
- id: 'git.stash-drop',
- category: 'Git',
- label: 'Git stash drop',
- description: 'Blocks dropping stash entries.',
- example: 'git stash drop stash@{0}',
- intent: 'use_alternative',
- },
- {
- id: 'git.stash-clear',
- category: 'Git',
- label: 'Git stash clear',
- description: 'Blocks clearing all stash entries.',
- example: 'git stash clear',
- intent: 'manual_only',
- },
- {
- id: 'git.worktree-remove-force',
- category: 'Git',
- label: 'Git worktree force remove',
- description: 'Blocks forced worktree removal.',
- example: 'git worktree remove --force ../feature',
- intent: 'use_alternative',
- },
- {
- id: 'rm.recursive-force-root-or-home',
- category: 'Filesystem',
- label: 'rm -rf root or home',
- description: 'Blocks recursive forced removal of root or home paths.',
- example: 'rm -rf /',
- Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
- Line 229 on GitHub
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'rm.git-metadata',
- category: 'Filesystem',
- label: 'rm Git metadata',
- description: 'Blocks removal of protected Git metadata and hooks.',
- example: 'rm -rf .git',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'rm.recursive-force-dynamic-target',
- category: 'Filesystem',
- label: 'rm -rf dynamic target',
- description: 'Blocks recursive forced removal with dynamic targets in strict mode.',
- example: 'rm -rf "$target"',
- intent: 'scope_down',
- activationCapability: 'fail_closed',
- },
- {
- id: 'rm.recursive-force-home-cwd',
- category: 'Filesystem',
- label: 'rm -rf from home cwd',
- description: 'Blocks recursive forced removal while working in home.',
- example: 'cd "$HOME" && rm -rf build',
- intent: 'scope_down',
- },
- {
- id: 'rm.recursive-force-cwd-self',
- category: 'Filesystem',
- label: 'rm -rf current directory',
- description: 'Blocks recursive forced removal of the current directory.',
- example: 'rm -rf .',
- intent: 'scope_down',
- },
- {
- id: 'rm.recursive-force-outside-cwd',
- category: 'Filesystem',
- label: 'rm -rf outside cwd',
- description: 'Blocks recursive forced removal outside the original cwd.',
- example: 'rm -rf ../outside',
- intent: 'scope_down',
- },
- {
- id: 'rm.recursive-force-paranoid',
- category: 'Filesystem',
- label: 'rm -rf paranoid mode',
- description: 'Blocks non-temp recursive forced removal when paranoid rm is enabled.',
- example: 'rm -rf ./cache',
- intent: 'scope_down',
- activationCapability: 'paranoid_rm',
- },
- {
- id: 'powershell.remove-item-root-or-home',
- category: 'PowerShell',
- label: 'Remove-Item root or home',
- description: 'Blocks PowerShell Remove-Item targeting root or home paths.',
- example: 'Remove-Item C:\\',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'powershell.remove-item-recursive-force-root-or-home',
- category: 'PowerShell',
- label: 'Remove-Item recursive force root or home',
- description: 'Blocks recursive forced PowerShell removal of root or home paths.',
- example: 'Remove-Item C:\\ -Recurse -Force',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'powershell.remove-item-git-metadata',
- category: 'PowerShell',
- label: 'Remove-Item Git metadata',
- description: 'Blocks PowerShell removal of protected Git metadata and hooks.',
- example: 'Remove-Item .git -Recurse -Force',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'powershell.remove-item-recursive-force-dynamic-target',
- category: 'PowerShell',
- label: 'Remove-Item recursive force dynamic target',
- description: 'Blocks recursive forced PowerShell removal with dynamic targets in strict mode.',
- example: 'Remove-Item $target -Recurse -Force',
- intent: 'scope_down',
- activationCapability: 'fail_closed',
- },
- {
- id: 'powershell.remove-item-recursive-force-home-cwd',
- category: 'PowerShell',
- label: 'Remove-Item recursive force from home cwd',
- description: 'Blocks recursive forced PowerShell removal while working in home.',
- example: 'Set-Location $HOME; Remove-Item ./build -Recurse -Force',
- intent: 'scope_down',
- },
- {
- id: 'powershell.remove-item-recursive-force-cwd-self',
- category: 'PowerShell',
- label: 'Remove-Item recursive force current directory',
- description: 'Blocks recursive forced PowerShell removal of the current directory.',
- example: 'Remove-Item . -Recurse -Force',
- intent: 'scope_down',
- },
- {
- id: 'powershell.remove-item-recursive-force-outside-cwd',
- category: 'PowerShell',
- label: 'Remove-Item recursive force outside cwd',
- description: 'Blocks recursive forced PowerShell removal outside the original cwd.',
- example: 'Remove-Item ../outside -Recurse -Force',
- intent: 'scope_down',
- },
- {
- id: 'powershell.remove-item-recursive-force-paranoid',
- category: 'PowerShell',
- label: 'Remove-Item recursive force paranoid mode',
- description: 'Blocks non-temp recursive forced PowerShell removal when paranoid rm is enabled.',
- example: 'Remove-Item ./cache -Recurse -Force',
- intent: 'scope_down',
- activationCapability: 'paranoid_rm',
- },
- {
- id: 'powershell.remove-item-pipeline-dynamic-target',
- category: 'PowerShell',
- label: 'Remove-Item pipeline dynamic target',
- description: 'Blocks PowerShell Remove-Item with unverifiable pipeline input in strict mode.',
- example: 'Get-ChildItem . -Recurse | Remove-Item -Force',
- intent: 'scope_down',
- activationCapability: 'fail_closed',
- },
- {
- id: 'powershell.nested-recursive-delete-unread',
- category: 'PowerShell',
- label: 'Nested PowerShell recursive delete not read',
- description:
- 'Blocks a recursive delete handed to powershell or pwsh in any form other than literal -Command script words.',
- example: "pwsh -WorkingDirectory C:\\ -c 'Remove-Item -Recurse -Force *'",
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'cmd.recursive-delete-root-or-home',
- category: 'Command Prompt',
- label: 'cmd recursive delete root or home',
- description: 'Blocks cmd rmdir /s or del /s of root or home paths.',
- example: 'cmd /c rmdir /s /q C:\\',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'cmd.recursive-delete-escaped-quote',
- category: 'Command Prompt',
- label: 'cmd recursive delete with escaped quotes',
- description:
- 'Blocks cmd rmdir /s or del /s whose quoting can reach cmd as \\" and split the target down to the drive root.',
- example: 'cmd /c "rmdir /s /q \\"build output\\""',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'cmd.recursive-delete-git-metadata',
- category: 'Command Prompt',
- label: 'cmd recursive delete Git metadata',
- description: 'Blocks cmd rmdir /s or del /s of protected Git metadata and hooks.',
- example: 'cmd /c rmdir /s /q .git',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'cmd.recursive-delete-dynamic-target',
- category: 'Command Prompt',
- label: 'cmd recursive delete dynamic target',
- description: 'Blocks cmd rmdir /s or del /s with wildcard or variable targets in strict mode.',
- example: 'cmd /c del /s /q *.log',
- intent: 'scope_down',
- activationCapability: 'fail_closed',
- },
- {
- id: 'cmd.recursive-delete-home-cwd',
- category: 'Command Prompt',
- label: 'cmd recursive delete from home cwd',
- description: 'Blocks cmd rmdir /s or del /s while working in home.',
- example: 'Set-Location $HOME; cmd /c rmdir /s /q build',
- intent: 'scope_down',
- },
- {
- id: 'cmd.recursive-delete-cwd-self',
- category: 'Command Prompt',
- label: 'cmd recursive delete current directory',
- description: 'Blocks cmd rmdir /s or del /s of the current directory.',
- example: 'cmd /c rmdir /s /q .',
- intent: 'scope_down',
- },
- {
- id: 'cmd.recursive-delete-outside-cwd',
- category: 'Command Prompt',
- label: 'cmd recursive delete outside cwd',
- description: 'Blocks cmd rmdir /s or del /s outside the original cwd.',
- example: 'cmd /c rmdir /s /q ..\\outside',
- intent: 'scope_down',
- },
- {
- id: 'cmd.recursive-delete-paranoid',
- category: 'Command Prompt',
- label: 'cmd recursive delete paranoid mode',
- description: 'Blocks non-temp cmd rmdir /s or del /s when paranoid rm is enabled.',
- example: 'cmd /c rmdir /s /q build',
- intent: 'scope_down',
- activationCapability: 'paranoid_rm',
- },
- {
- id: 'find.delete',
- category: 'Filesystem',
- label: 'find delete',
- description: 'Blocks unsafe find -delete operations.',
- example: 'find . -delete',
- intent: 'scope_down',
- },
- {
- id: 'find.delete-git-metadata',
- category: 'Filesystem',
- label: 'find delete Git metadata',
- description: 'Blocks find -delete operations selecting protected Git metadata and hooks.',
- example: 'find .git -delete',
- intent: 'hard_stop',
- catastrophic: true,
- },
- {
- id: 'find.exec-rm-recursive-force',
- category: 'Filesystem',
- label: 'find exec rm -rf',
- description: 'Blocks find -exec rm -rf operations.',
- example: 'find . -exec rm -rf {} +',
- intent: 'scope_down',
- },
- {
- id: 'rsync.delete',
- category: 'Filesystem',
- label: 'rsync delete',
- description:
- 'Blocks rsync delete modes whose destination is outside the cwd, a temp root, or a variable.',
- example: 'rsync -a --delete "$SRC/" "$DST/"',
- intent: 'scope_down',
- },
- {
- id: 'dd.device-write',
- category: 'Filesystem',
- label: 'dd device write',
- description:
- 'Blocks dd writing to a /dev device other than /dev/null, /dev/zero, or /dev/full.',
- example: 'dd if=/dev/zero of=/dev/sda',
- intent: 'manual_only',
- },
- {
- id: 'mkfs.device',
- category: 'Filesystem',
- label: 'Filesystem format on a device',
- description: 'Blocks mkfs, mke2fs, and newfs formatting a /dev device.',
- example: 'mkfs.ext4 /dev/sda1',
- intent: 'manual_only',
- },
- {
- id: 'disk.erase',
- category: 'Filesystem',
- label: 'Disk erase or repartition',
- description:
- 'Blocks diskutil erase and partition verbs, wipefs -a/-o, sgdisk writes, and parted label or partition edits on a /dev device.',
- example: 'diskutil eraseDisk APFS Untitled disk4',
- intent: 'manual_only',
- },
- {
- id: 'shred.target',
- category: 'Filesystem',
- label: 'shred target',
- description: 'Blocks shred against any target, including shred --help and shred --version.',
- example: 'shred -u secret.txt',
- intent: 'use_alternative',
- },
- {
- id: 'redirect.block-device',
- category: 'Filesystem',
- label: 'Redirect onto a disk device',
- description: 'Blocks output redirects whose literal target is a disk device path under /dev.',
- example: 'cat disk.img > /dev/sda',
- intent: 'manual_only',
- },
- {
- id: 'network.cloud-metadata',
- category: 'Network',
- label: 'Cloud metadata endpoint',
- description:
- 'Blocks HTTP clients, raw socket tools, and code interpreters naming a cloud metadata host (169.254.169.254, fd00:ec2::254, 169.254.170.2, 169.254.170.23, fd00:ec2::23, metadata.google.internal, metadata.goog, 100.100.100.200).',
- example: 'curl http://169.254.169.254/latest/meta-data/iam/security-credentials/',
- Note: Quoted as data in code: Fetches a raw IP-literal URL — ambiguous (could be legitimate internal tooling) but worth a second look
- Line 524 on GitHub
- intent: 'manual_only',
- },
- {
- id: 'network.upload-remote',
- category: 'Network',
- label: 'Data upload to a remote host',
- description:
- 'Blocks curl and wget requests that send a body or upload a file in strict mode unless every URL is loopback (localhost, *.localhost, 127.0.0.0/8, 0.0.0.0, [::1]).',
- example: 'curl -T backup.tar https://uploads.example.com/',
- intent: 'manual_only',
- activationCapability: 'fail_closed',
- },
- {
- id: 'unshare.user-namespace',
- category: 'Execution',
- label: 'unshare user namespace',
- description:
- 'Blocks unshare creating a user namespace: -U/--user, -r/--map-root-user, -c/--map-current-user, --map-user(s), --map-group(s), or --map-auto.',
- example: 'unshare -r id',
- intent: 'manual_only',
- },
- {
- id: 'interpreter.dangerous-command',
- category: 'Execution',
- label: 'Interpreter dangerous command',
- description: 'Blocks interpreter one-liners containing dangerous commands.',
- example: `python -c "import os; os.system('rm -rf /')"`,
- Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
- Line 551 on GitHub
- intent: 'use_alternative',
- },
- {
- id: 'interpreter.one-liner-paranoid',
- category: 'Execution',
- label: 'Interpreter one-liner paranoid mode',
- description: 'Blocks interpreter one-liners when paranoid interpreters is enabled.',
- example: 'python -c "print(1)"',
- intent: 'use_alternative',
- activationCapability: 'paranoid_interpreters',
- },
- {
- id: 'awk.system-dynamic',
- category: 'Execution',
- label: 'Awk dynamic system call',
- description: 'Blocks awk system calls that cannot be safely analyzed.',
- example: "awk '{ system($0) }'",
- intent: 'stop_and_explain',
- },
- {
- id: 'xargs.rm-recursive-force-dynamic',
- category: 'Execution',
- label: 'xargs dynamic rm -rf',
- description: 'Blocks xargs rm -rf with dynamic input.',
- example: 'printf / | xargs rm -rf',
- intent: 'scope_down',
- },
- {
- id: 'xargs.shell-dynamic',
- category: 'Execution',
- label: 'xargs dynamic shell',
- description: 'Blocks xargs shell execution with dynamic input.',
- example: 'xargs r$(printf m) -rf',
- intent: 'scope_down',
- },
- {
- id: 'parallel.rm-recursive-force-dynamic',
- category: 'Execution',
- label: 'parallel dynamic rm -rf',
- description: 'Blocks parallel rm -rf with dynamic input.',
- example: 'printf / | parallel rm -rf',
- intent: 'scope_down',
- },
- {
- id: 'parallel.shell-dynamic',
- category: 'Execution',
- label: 'parallel dynamic shell',
- description: 'Blocks parallel shell execution with dynamic input.',
- example: 'parallel r$(printf m) -rf ::: child',
- intent: 'scope_down',
- },
- {
- id: 'parallel.command-stream-dynamic',
- category: 'Execution',
- label: 'parallel dynamic command stream',
- description: 'Blocks parallel command streams from dynamic input.',
- example: 'parallel --dry-run',
- intent: 'scope_down',
- },
- {
- id: 'shell.dynamic-structure',
- category: 'Execution',
- label: 'Dynamic command structure',
- description:
- 'Blocks guarded subcommands and options assembled from substitution output in strict mode.',
- example: 'git reset $(printf --hard)',
- intent: 'stop_and_explain',
- activationCapability: 'fail_closed',
- },
- {
- id: 'shell.dynamic-executable',
- category: 'Execution',
- label: 'Dynamic executable name',
- description:
- 'Blocks executable names assembled from command substitution output in strict mode.',
- example: '$(printf r)m -rf /',
- intent: 'manual_only',
- activationCapability: 'fail_closed',
- },
- {
- id: 'raw-text.dangerous-command',
- category: 'Execution',
- label: 'Raw text dangerous command',
- description: 'Blocks dangerous commands detected in raw command text.',
- example: "git reset --hard 'unterminated",
- intent: 'stop_and_explain',
- },
- ] as const satisfies readonly DestructiveCommandRuleMetadata[];
- export type DestructiveCommandRuleId = (typeof DESTRUCTIVE_COMMAND_RULE_DEFINITIONS)[number]['id'];
- export const DESTRUCTIVE_COMMAND_RULE_ID_SET = new Set<string>(
- DESTRUCTIVE_COMMAND_RULE_DEFINITIONS.map((rule) => rule.id),
- );
- export const DESTRUCTIVE_COMMAND_RULE_METADATA: readonly DestructiveCommandRuleMetadata[] =
- DESTRUCTIVE_COMMAND_RULE_DEFINITIONS;
- const DESTRUCTIVE_COMMAND_RULE_INTENTS = new Map(
- DESTRUCTIVE_COMMAND_RULE_METADATA.map((rule) => [rule.id, rule.intent]),
- );
- export function destructiveCommandMatch(id: DestructiveCommandRuleId, reason: string) {
- return {
- id,
- reason,
- intent: DESTRUCTIVE_COMMAND_RULE_INTENTS.get(id) ?? 'manual_only',
- };
- }
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.