cc-safety-net 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ https://github.com/user-attachments/assets/928dbe97-31e3-41d1-b35a-7941a701b056
19
19
 
20
20
  </div>
21
21
 
22
- 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 never blocks anything.
22
+ 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 never blocks anything. It is not a sandbox: it does not contain processes, set filesystem permissions, or watch network egress.
23
23
 
24
24
  > [!NOTE]
25
25
  > **[Full documentation →](https://ccsafetynet.com/docs)** covers installation, configuration, reference material, guides, and the security model. This README is the short version.
@@ -34,11 +34,9 @@ CC Safety Net (Coding CLI Safety Net) blocks destructive commands and access to
34
34
  </picture>
35
35
  </p>
36
36
 
37
- Details: [How It Works](https://ccsafetynet.com/docs/guides/how-it-works).
38
-
39
37
  ## Supported coding CLIs
40
38
 
41
- CC Safety Net supports the coding agent CLIs below on Windows, macOS, and Linux. Automated tests cover the analyzer and some Windows integrations. Windows support for the remaining CLIs is best effort and has not been tested.
39
+ CC Safety Net supports these coding agent CLIs on Windows, macOS, and Linux.
42
40
 
43
41
  <table align="center">
44
42
  <tr>
@@ -46,10 +44,14 @@ CC Safety Net supports the coding agent CLIs below on Windows, macOS, and Linux.
46
44
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#antigravity-cli-installation"><img alt="Antigravity CLI" src="./.github/assets/antigravity-cli.png" height="32"><br>Antigravity CLI</a></td>
47
45
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#claude-code-installation"><img alt="Claude Code" src="./.github/assets/claude-code.svg" height="32"><br>Claude Code</a></td>
48
46
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#codex-installation"><img alt="Codex" src="./.github/assets/codex.svg" height="32"><br>Codex</a></td>
49
- <td align="center"><a href="https://ccsafetynet.com/docs/installation#cursor-installation"><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>
50
47
  </tr>
51
48
  <tr>
49
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#cursor-installation"><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>
52
50
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#deepseek-harness-installation"><img alt="DeepSeek Harness" src="./.github/assets/deepseek.svg" height="32"><br>DeepSeek Harness</a></td>
51
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#devin-cli-installation"><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>
52
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#factory-droid-installation"><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>
53
+ </tr>
54
+ <tr>
53
55
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#gemini-cli-installation"><img alt="Gemini CLI" src="./.github/assets/gemini-cli.svg" height="32"><br>Gemini CLI</a></td>
54
56
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#github-copilot-cli-installation"><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>
55
57
  <td align="center"><a href="https://ccsafetynet.com/docs/installation#grok-build-installation"><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>
@@ -63,151 +65,30 @@ CC Safety Net supports the coding agent CLIs below on Windows, macOS, and Linux.
63
65
  </tr>
64
66
  </table>
65
67
 
66
- Amp documents macOS, Linux, and WSL, but not native Windows.
67
68
 
68
69
  ## Features
69
70
 
70
- - **Blocks destructive commands.** `git reset --hard`, `git push --force`, `rm -rf` on dangerous targets, `find -delete`, and PowerShell `Remove-Item`. The hook still blocks the same command inside `bash -c` or `python -c`. A sandbox still allows `git reset --hard` inside your project. See [vs Sandboxing](https://ccsafetynet.com/docs/guides/vs-sandboxing).
71
- - **Blocks secret access.** SSH keys, `.env` files, `~/.aws`, and the credential files coding CLIs keep. The rules cover the shell and the agent's read, edit, write, and search tools. Blocking a CLI's own settings files is optional. It stays off until you turn it on.
72
- - **Customize the rules in a GUI.** Run `npx cc-safety-net gui` and open Policy. Turn individual block and secret rules off. Add paths to allow or deny. You cannot turn off the rules that catch wiping `/` or `~`.
73
- - **Adds blocks through rulebooks.** Official packs for Terraform, AWS, gcloud, and Azure, or JSON you write yourself. A rulebook can only add blocks. It cannot turn built-in protection off. The packs live in [cc-safety-net/rulebooks](https://github.com/cc-safety-net/rulebooks). Install a pack with:
74
-
75
- ```bash
76
- npx -y cc-safety-net rule add --only terraform aws --global
77
- ```
78
-
79
- See [Official Rulebooks](https://ccsafetynet.com/docs/configuration/rulebooks).
80
- - **Shares policy through git.** Commit `.cc-safety-net/` so clones and cloud sessions pick up the same rules. If a project file tries to loosen a member's stricter settings, `status` and `doctor` report it. `policy apply` asks for confirmation in a terminal. Copying the folder is not enough. The hook still has to be installed. See [Team Setup](https://ccsafetynet.com/docs/guides/team-setup) and [Cloud Environments](https://ccsafetynet.com/docs/guides/cloud-environments).
81
- - **Embeds in your own tools.** Install the npm package and call `checkCommand` to get allow or deny from your own code. No hook required. See [Library API](#library-api).
82
-
83
- Full rule catalogs: [Blocked Commands](https://ccsafetynet.com/docs/reference/blocked-commands) · [Allowed Commands](https://ccsafetynet.com/docs/reference/allowed-commands) · [Secret Protection](https://ccsafetynet.com/docs/reference/secret-protection).
71
+ - **Blocks destructive commands** such as `git reset --hard`, `git push --force`, and `rm -rf` on dangerous targets, even inside `bash -c` or `python -c`. See [Blocked Commands](https://ccsafetynet.com/docs/reference/blocked-commands).
72
+ - **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).
73
+ - **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 [Modes](https://ccsafetynet.com/docs/configuration/modes).
74
+ - **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).
75
+ - **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).
76
+ - **Embeds in your own tools.** Call `checkCommand` from Node.js without installing the hook. See [Library API](https://ccsafetynet.com/docs/reference/library-api).
84
77
 
85
78
  ## Quick start
86
79
 
87
- You need Node.js 18 or higher.
88
-
89
- To install into the coding CLIs on this machine, run:
80
+ You need Node.js 18 or higher. Install into the coding CLIs on this machine, then check that protection is working:
90
81
 
91
82
  ```bash
92
83
  npx -y cc-safety-net@latest install
84
+ npx -y cc-safety-net@latest doctor
93
85
  ```
94
86
 
95
- To update every installed integration:
96
-
97
- ```bash
98
- npx -y cc-safety-net@latest update
99
- ```
100
-
101
- Keep the `@latest` qualifier. A bare `cc-safety-net` spec can run an older copy from the npx cache. To uninstall, run `npx -y cc-safety-net uninstall`. `npm install -g cc-safety-net` also installs the `ccsn` alias.
102
-
103
- OpenCode integration supports v1.18.29+ and v2.0.6+. Run `npx -y cc-safety-net@latest install --opencode`; the installer selects the host's plugin commands. See [OpenCode compatibility](docs/opencode-compatibility.md) for v2 shell configuration and host limitations.
104
-
105
- DeepSeek Harness integration installs as a profile plugin bundle into each DeepSeek Harness on the machine. `npx -y cc-safety-net@latest install --deepseek-harness` adds it to the Desktop app through Desktop's bundled `dsh` command; quit Desktop first, and open it once beforehand so it has a profile. Both profiles get the installer's own version, so pnpm's minimum release age cannot hold a new release back to an older one. It adds it to the web profile through `npx -y @deepseek-ai/dsh plugin --profile web add cc-safety-net@<version>`, which reuses the DeepSeek Harness that `npx @deepseek-ai/dsh web` or a global install runs and needs `pnpm` on your PATH. The installer looks for Desktop in its default location; if yours is elsewhere, add `cc-safety-net` from its Plugins page.
106
-
107
- OpenClaw integration requires OpenClaw 2026.8.1+. The installer accepts the plugin's declared capabilities for you, and older OpenClaw releases reject that option.
108
-
109
- ## Safety presets
110
-
111
- To set a preset, run `npx cc-safety-net gui` and open Policy.
112
-
113
- | Preset | Effect |
114
- |---|---|
115
- | Standard | Blocks recognizable destructive Git and filesystem commands. Allows metadata-only checks of built-in sensitive paths while continuing to block content access. Recommended for normal coding. |
116
- | Strict | Standard, plus blocks dynamic or unparseable commands the analyzer cannot verify safely. Also blocks metadata-only discovery of built-in sensitive paths. Occasional false positives on advanced shell. |
117
- | Paranoid | Strict, plus blocks `rm -rf` inside your project and interpreter one-liners. Expect friction; for untrusted agents or high-stakes repos. |
118
-
119
- Linked-worktree mode relaxes only local discard. Git discards inside a temp-root repository unrelated to the workspace are allowed like temp deletes (local discards only when that repository is a linked worktree), as is `git worktree remove --force` of an existing temp-root directory unrelated to the workspace. See [Modes](https://ccsafetynet.com/docs/configuration/modes).
120
-
121
- To allow one file name you manage at any depth under a folder, add an entry such as `"~/code/**/.env.local"` to `secret_protection.allow_paths` in your user policy. Other env variants stay blocked. The folder before `**/` is required and cannot be your home directory or a folder above it, so home credentials such as `~/.ssh` and `~/.npmrc` stay protected. Only a folder, `**/`, and an exact file name are supported; configured deny paths and Coding CLI protections still win. Many frameworks keep local secrets in `.env.local`, so allow it only if that matches how you use it.
122
-
123
- ## Diagnostics
124
-
125
- ```bash
126
- # Summarize what is being enforced right now
127
- npx cc-safety-net status
128
- # Verify your installation and run a self-test
129
- npx cc-safety-net doctor
130
- # Trace how a command is analyzed step-by-step
131
- npx cc-safety-net explain "git reset --hard"
132
- # Browse recorded denials from the audit trail (add --all to include allowed commands)
133
- npx cc-safety-net logs
134
- # Review what was blocked and edit your policy in a local web GUI
135
- npx cc-safety-net gui
136
- ```
137
-
138
- `doctor`, `explain`, and `logs` support `--json` for machine-readable output. The audit trail stays on your machine. It records command decisions, but it does not record command output or prompts.
139
-
140
- Details: [CLI Commands](https://ccsafetynet.com/docs/reference/cli-commands) · [Explain Trace](https://ccsafetynet.com/docs/reference/explain-trace) · [Audit Log](https://ccsafetynet.com/docs/reference/audit-log) · [Dashboard](https://ccsafetynet.com/docs/guides/dashboard) · [Configuration Recovery](https://ccsafetynet.com/docs/configuration/recovery).
141
-
142
- ## Limitations
143
-
144
- CC Safety Net denies a tool call before it runs. It does not set filesystem permissions, watch network egress, or contain a process.
145
-
146
- The policy and secret-path extractors are mostly POSIX. For PowerShell they resolve a home prefix (`$HOME`, `$env:USERPROFILE`, `$env:HOME`, or `~`) joined to a literal suffix with `\` or `/`. The same check applies to `Get-Content`, `Set-Content`, `Add-Content`, `Copy-Item`, `Move-Item`, `Remove-Item`, and their aliases. `Get-Content $HOME\.ssh\id_rsa` is denied. A path built by concatenation, a subexpression, or `Join-Path` is not.
147
-
148
- Policy-file protection matches exact paths. It does not emulate commands. Use OS permissions or a sandbox when you need that.
149
-
150
- Codex has two integration-specific limits. Its unified exec path is the default shell path. It sends a hook payload when a command starts a session, but it sends none for `write_stdin`. CC Safety Net can inspect and audit the command that opens the session. It cannot inspect or audit text that the model types into the running session. Codex emits no event for that call, so an adapter change cannot close this gap. The `exec_command` payload also omits the call's `workdir`: it carries only `{command}`, and its `cwd` is the turn directory. Codex runs the command in `workdir`, but CC Safety Net analyzes it in the turn directory, so relative paths and outside-directory rules can be judged against the wrong directory.
151
-
152
- [SECURITY.md](SECURITY.md) contains the full residual-risk registry. [Known Limitations](https://ccsafetynet.com/docs/guides/known-limitations) explains what those risks mean in practice.
153
-
154
- ## Upgrading from an older version
155
-
156
- Run the `update` command from [Quick start](#quick-start) to upgrade every installed integration to the current release.
157
-
158
- If you installed rulebooks from GitHub on version 2.2 or earlier, run `npx -y cc-safety-net rule sync` once per scope after upgrading. Add `--global` for user-scope sources. Rulebooks are now live files in your config. The command copies each cached rulebook into that location and removes the leftovers. Until you run it, those GitHub-sourced rules are inactive. `status` and `doctor` report the degraded sources.
159
-
160
- > [!WARNING]
161
- > If you defined custom rules in a legacy inline config such as `.safety-net.json` or `~/.cc-safety-net/config.json`, CC Safety Net no longer loads those files at runtime. Their rules enforce nothing. Normal use does not show this failure because the commands now run. Run `npx -y cc-safety-net rule migrate` to convert the rules to the rulebook layout. Then run `npx -y cc-safety-net doctor` and confirm that the runtime is `ready`. See the [migration guide](https://ccsafetynet.com/docs/configuration/custom-rules#migrate-legacy-configuration).
162
-
163
- ## Full documentation
164
-
165
- The **[ccsafetynet.com/docs](https://ccsafetynet.com/docs)** site contains the full documentation:
166
-
167
- | Area | Pages |
168
- |---|---|
169
- | Get started | [Introduction](https://ccsafetynet.com/docs/introduction) · [Installation](https://ccsafetynet.com/docs/installation) · [Quickstart](https://ccsafetynet.com/docs/quickstart) · [Team Setup](https://ccsafetynet.com/docs/guides/team-setup) · [Cloud Environments](https://ccsafetynet.com/docs/guides/cloud-environments) · [How It Works](https://ccsafetynet.com/docs/guides/how-it-works) · [Dashboard](https://ccsafetynet.com/docs/guides/dashboard) |
170
- | Configuration | [Modes](https://ccsafetynet.com/docs/configuration/modes) · [Policy](https://ccsafetynet.com/docs/configuration/policy) · [Environment](https://ccsafetynet.com/docs/configuration/environment) · [Custom Rules](https://ccsafetynet.com/docs/configuration/custom-rules) · [Official Rulebooks](https://ccsafetynet.com/docs/configuration/rulebooks) · [Status Line](https://ccsafetynet.com/docs/configuration/status-line) · [Configuration Recovery](https://ccsafetynet.com/docs/configuration/recovery) |
171
- | Reference | [Blocked Commands](https://ccsafetynet.com/docs/reference/blocked-commands) · [Allowed Commands](https://ccsafetynet.com/docs/reference/allowed-commands) · [Secret Protection](https://ccsafetynet.com/docs/reference/secret-protection) · [Audit Log](https://ccsafetynet.com/docs/reference/audit-log) · [CLI Commands](https://ccsafetynet.com/docs/reference/cli-commands) · [Explain Trace](https://ccsafetynet.com/docs/reference/explain-trace) · [Glossary](https://ccsafetynet.com/docs/reference/glossary) |
172
- | Guides | [Architecture](https://ccsafetynet.com/docs/guides/architecture) · [Analysis Engine](https://ccsafetynet.com/docs/guides/analysis-engine) · [Design Principles](https://ccsafetynet.com/docs/guides/design-principles) · [Security Model](https://ccsafetynet.com/docs/guides/security-model) · [vs Sandboxing](https://ccsafetynet.com/docs/guides/vs-sandboxing) · [Integration Architecture](https://ccsafetynet.com/docs/guides/integration-architecture) · [Embedding](https://ccsafetynet.com/docs/guides/embedding) · [Known Limitations](https://ccsafetynet.com/docs/guides/known-limitations) · [Troubleshooting](https://ccsafetynet.com/docs/guides/troubleshooting) |
173
- | Project | [Contributing](https://ccsafetynet.com/docs/contributing) · [Security Policy](https://ccsafetynet.com/docs/security) |
174
-
175
- ## The cc-safety-net skill
176
-
177
- The skill is the operating manual for CC Safety Net. Ask it anything about the tool: why a command was blocked, whether a block was wrong, how to write or migrate custom rules, how to change the policy or safety level, how to install or remove an integration, or whether protection is working at all. When the CLI output cannot settle a question, it reads the source of the installed version and answers from that.
178
-
179
- ```text
180
- /cc-safety-net why was my last git command blocked
181
- /cc-safety-net block terraform destroy in this repo
182
- /cc-safety-net is secret protection active in Codex?
183
- ```
184
-
185
- The command ships with the Claude Code and Codex plugins and is built into the OpenCode and Pi integrations. The skill loads only when you invoke it, so it takes no context-window space until you type the command. The agent cannot trigger it on its own.
186
-
187
- ## Library API
188
-
189
- To check a command from Node.js without installing the hook:
190
-
191
- ```bash
192
- npm install cc-safety-net
193
- ```
194
-
195
- ```ts
196
- import { checkCommand } from 'cc-safety-net/api';
197
-
198
- const result = checkCommand({ command: 'git status', cwd: process.cwd() });
199
- if (result.kind !== 'allow') {
200
- throw new Error(result.reason);
201
- }
202
- ```
203
-
204
- `cwd` must be an absolute directory path. If `checkCommand` throws, do not run the command.
205
-
206
- A full example is in [Embedding](https://ccsafetynet.com/docs/guides/embedding).
87
+ 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).
207
88
 
208
89
  ## Development
209
90
 
210
- See [CONTRIBUTING.md](CONTRIBUTING.md) to contribute to the project.
91
+ See [CONTRIBUTING.md](CONTRIBUTING.md) to report a bug or request a feature.
211
92
 
212
93
  ## License
213
94