cc-safety-net 2.0.5 → 2.0.7

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
@@ -9,22 +9,12 @@
9
9
  [![CI](https://github.com/kenryu42/cc-safety-net/actions/workflows/ci.yml/badge.svg)](https://github.com/kenryu42/cc-safety-net/actions/workflows/ci.yml)
10
10
  [![codecov](https://codecov.io/github/kenryu42/cc-safety-net/branch/main/graph/badge.svg?token=C9QTION6ZF)](https://codecov.io/github/kenryu42/cc-safety-net)
11
11
  [![Version](https://img.shields.io/github/v/tag/kenryu42/cc-safety-net?label=version&color=blue)](https://github.com/kenryu42/cc-safety-net)
12
- [![Amp Code](https://img.shields.io/badge/Amp%20Code-467C51)](https://ccsafetynet.com/docs/installation#amp-code-installation)
13
- [![Antigravity CLI](https://img.shields.io/badge/Antigravity%20CLI-8AA1F8)](https://ccsafetynet.com/docs/installation#antigravity-cli-installation)
14
- [![Claude Code](https://img.shields.io/badge/Claude%20Code-D27656)](https://ccsafetynet.com/docs/installation#claude-code-installation)
15
- [![Codex](https://img.shields.io/badge/Codex-white)](https://ccsafetynet.com/docs/installation#codex-installation)
16
- [![Cursor](https://img.shields.io/badge/Cursor-000000)](https://ccsafetynet.com/docs/installation#cursor-installation)
17
- [![Gemini CLI](https://img.shields.io/badge/Gemini%20CLI-678AE3)](https://ccsafetynet.com/docs/installation#gemini-cli-installation)
18
- [![GitHub Copilot CLI](https://img.shields.io/badge/GitHub%20Copilot%20CLI-4EA5C9)](https://ccsafetynet.com/docs/installation#github-copilot-cli-installation)
19
- [![Hermes Agent](https://img.shields.io/badge/Hermes%20Agent-2D3E50)](#hermes-agent-and-openclaw)
20
- [![Kimi Code](https://img.shields.io/badge/Kimi%20Code-5587FF)](https://ccsafetynet.com/docs/installation#kimi-code-installation)
21
- [![OpenClaw](https://img.shields.io/badge/OpenClaw-B4532A)](#hermes-agent-and-openclaw)
22
- [![OpenCode](https://img.shields.io/badge/OpenCode-black)](https://ccsafetynet.com/docs/installation#opencode-installation)
23
- [![Pi](https://img.shields.io/badge/Pi%20Coding-22262E)](https://ccsafetynet.com/docs/installation#pi-installation)
24
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)
25
13
 
26
14
  <div align="center">
27
15
 
16
+ **English** · [简体中文](https://ccsafetynet.com/docs/zh-Hans) · [日本語](https://ccsafetynet.com/docs/ja)
17
+
28
18
  [![CC Safety Net](./.github/assets/cc-safety-net-v2.png)](./.github/assets/cc-safety-net-v2.png)
29
19
 
30
20
  </div>
@@ -46,7 +36,7 @@ We learned the [hard way](https://www.reddit.com/r/ClaudeAI/comments/1pgxckk/cla
46
36
  - **Rebuilt evaluation engine** — canonical command IR, deeply immutable policy snapshots, and an ordered guard pipeline with intrinsic decision tracing behind `explain`.
47
37
  - **Secret protection** — built-in rules block content access to SSH keys, `.env` files, cloud credentials, and coding-CLI credential stores, across shell commands and file tools alike.
48
38
  - **Always-on catastrophic protections** — recursive deletion of root or home, Git metadata mutation (`.git` control plane, hooks, worktrees, submodules), and mutation of the user policy file are blocked in every mode, regardless of overrides.
49
- - **Safety presets** — `standard`/`strict`/`paranoid` levels with per-rule overrides, trusted delete allow-paths, and env vars that can only raise protection.
39
+ - **Safety presets** — `standard`/`strict`/`paranoid` levels with per-rule overrides, trusted delete allow-paths, and safety-level and capability env vars that can only raise protection — the one deliberate exception is `CC_SAFETY_NET_WORKTREE`, which allows local git discards in linked worktrees.
50
40
  - **Policy GUI** — `cc-safety-net gui` serves a local, token-authenticated editor with live preset preview.
51
41
  - **Universal installer** — interactive `install`/`uninstall` across all twelve supported agent CLIs, with an `update` command for installed integrations.
52
42
  - **Command-decision audit trail** — allowed and blocked command decisions recorded by default to local per-project JSONL with secret redaction, retained for 30 days by default, browsable via `cc-safety-net logs`.
@@ -84,83 +74,30 @@ npm install -g cc-safety-net
84
74
  ccsn doctor
85
75
  ```
86
76
 
87
- CC Safety Net works across twelve coding agent CLIs — **Claude Code, Antigravity CLI, Codex, Gemini CLI, GitHub Copilot CLI, Kimi Code, OpenCode, Pi, Cursor, Amp Code, Hermes Agent, and OpenClaw** — on **Windows, macOS, and Linux** (the Hermes Agent and OpenClaw integrations are macOS and Linux only; see [Hermes Agent and OpenClaw](#hermes-agent-and-openclaw)). Per-agent instructions, the target flags for scripted non-interactive installs, post-install steps, and per-agent caveats are on [Installation](https://ccsafetynet.com/docs/installation); how each integration hooks its agent is on [Integration Architecture](https://ccsafetynet.com/docs/guides/integration-architecture).
88
-
89
- ## Hermes Agent and OpenClaw
90
-
91
- These two integrations are newer than the docs site, so their setup steps and coverage
92
- boundaries live here.
93
-
94
- ```bash
95
- # Hermes Agent — installs a managed Python plugin, then restart Hermes
96
- npx -y cc-safety-net@latest install --hermes-agent
97
- npx -y cc-safety-net@latest uninstall --hermes-agent
98
-
99
- # OpenClaw — installs a bundled plugin through OpenClaw's own CLI, then restart the Gateway
100
- npx -y cc-safety-net@latest install --openclaw
101
- npx -y cc-safety-net@latest uninstall --openclaw
102
- ```
103
-
104
- Run `npx cc-safety-net doctor` after either install: it is the only surface that reports a plugin
105
- that is present but not enabled, not ours, or out of date. It reads disk and config only and never
106
- asks a running host whether the plugin loaded, so a stopped OpenClaw Gateway is not reported as a
107
- failure — the OpenClaw install verifies the load itself.
108
-
109
- **Hermes Agent.** Install writes a managed plugin to `$HERMES_HOME/plugins/cc-safety-net/`
110
- (`~/.hermes` when `HERMES_HOME` is unset) and then
111
- runs `hermes plugins enable cc-safety-net --no-allow-tool-override`. It is an ordinary Hermes user
112
- plugin: it runs inside the Hermes process with the trust Hermes grants user plugins, and it is
113
- inert until Hermes is restarted. On every `pre_tool_call` it shells out to
114
- `npx -y cc-safety-net hook --hermes-agent` with a 30-second timeout, and blocks the call itself
115
- whenever that analysis cannot complete — missing `npx`, spawn failure, timeout, unreadable output,
116
- or a Hermes session directory it cannot read.
117
- Protected tools are `terminal`, `read_file`, `write_file`, and `patch`; calls to any other Hermes
118
- tool are not forwarded and get no decision. Uninstall runs `hermes plugins disable cc-safety-net`
119
- first — Hermes only resolves a plugin that is still on disk — and then removes the managed files,
120
- so the config entry goes with them; a failing or missing `hermes` is reported as a warning and the
121
- files are removed anyway.
122
-
123
- **OpenClaw.** Install runs `openclaw plugins install <bundled plugin dir> --force` followed by
124
- `openclaw plugins enable cc-safety-net`, then verifies the plugin actually loaded. **Restart the
125
- OpenClaw Gateway afterwards, and if `plugins.allow` is set in `openclaw.json` it must also list
126
- `cc-safety-net`** — until both are true the plugin never runs and nothing is blocked. The plugin
127
- registers `before_tool_call` for the canonical `exec` tool only and returns a plain allow or
128
- block; it never rewrites tool parameters. It resolves the agent workspace as the policy and
129
- execution directory, and denies a call whose `workdir` resolves outside that workspace or whose
130
- agent or workspace context cannot be established. Live end-to-end tests (`bun run test:e2e:live`,
131
- run before a release) drive the real `openclaw` binary against a throwaway state directory: our
132
- CLI installs the plugin, the host reports it loaded with the hook registered, and a real Gateway
133
- agent turn puts a real `exec` call through it — a harmless command runs, `git reset --hard` is
134
- blocked before it can touch the workspace.
135
-
136
- **What is not covered.**
137
-
138
- - **Hermes bang-shell.** A `!command` you type yourself does not raise `pre_tool_call`; it goes
139
- straight to Hermes' own command guard. CC Safety Net sees model-generated tool calls only, not
140
- every subprocess Hermes starts.
141
- - **Hermes shell hooks fail open.** Hermes' `hooks:` dispatcher allows the tool call when a hook
142
- cannot start, times out, or returns unparseable output. That is why the shipped integration is
143
- the Python plugin, which blocks on its own failures, and why `hooks:` is a diagnostic path only.
144
- One case stays outside our reach either way: if Hermes never loads the plugin, nothing blocks
145
- and only `doctor` will say so.
146
- - **OpenClaw execution hosts.** `exec` calls with no `host`, `host: "auto"`, or `host: "gateway"`
147
- are analysed as local Gateway calls. Explicit `host: "sandbox"` and `host: "node"` are blocked
148
- as unsupported, because no test proves a correct path mapping for them. When a sandbox runtime
149
- is active, an `auto` call runs in the sandbox filesystem while paths are still analysed against
150
- the Gateway workspace — command rules are unaffected, path rules can be evaluated against the
151
- wrong filesystem. The same applies when a call carries no `host` and your configured
152
- `tools.exec.host` default is `node` or `sandbox`: the call is still analysed as a local Gateway
153
- call.
154
- - **OpenClaw Codex-native relay.** Untested, and therefore unclaimed. The live end-to-end tests
155
- drive OpenClaw's own agent runtime, so they say nothing about a Codex-native shell, patch, or
156
- MCP call.
157
- - **OpenClaw file tools.** `apply_patch` and OpenClaw's read/write/edit tools are not protected;
158
- only `exec` is.
159
- - **Windows.** Both integrations assume the POSIX layout. Relocated state is handled the way the
160
- hosts resolve it — `HERMES_HOME` for Hermes, then `OPENCLAW_STATE_DIR` and the directory of
161
- `OPENCLAW_CONFIG_PATH` for OpenClaw, falling back to `~/.hermes` and `~/.openclaw`. The Windows
162
- defaults are not: install and detection target the POSIX path there, so Hermes writes to the
163
- wrong directory and OpenClaw's own CLI installs correctly while `doctor` misreports the state.
77
+ ## Supported coding CLIs
78
+
79
+ CC Safety Net works across all coding agent CLIs on **Windows, macOS, and Linux**. Windows is covered by automated tests for the analyzer and a subset of integrations; for the remaining hosts it is best-effort and untested, and Amp's own manual documents macOS, Linux, and WSL rather than native Windows.
80
+
81
+ <table align="center">
82
+ <tr>
83
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#amp-code-installation"><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>
84
+ <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>
85
+ <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>
86
+ <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>
87
+ </tr>
88
+ <tr>
89
+ <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>
90
+ <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>
91
+ <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>
92
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#hermes-agent-installation"><img alt="Hermes Agent" src="./.github/assets/hermes.png" height="32"><br>Hermes Agent</a></td>
93
+ </tr>
94
+ <tr>
95
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#kimi-code-installation"><img alt="Kimi Code" src="./.github/assets/kimi-cli.png" height="32"><br>Kimi Code</a></td>
96
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#openclaw-installation"><img alt="OpenClaw" src="./.github/assets/openclaw.png" height="32"><br>OpenClaw</a></td>
97
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#opencode-installation"><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>
98
+ <td align="center"><a href="https://ccsafetynet.com/docs/installation#pi-installation"><picture><source media="(prefers-color-scheme: dark)" srcset="./.github/assets/pi-dark.svg"><img alt="Pi" src="./.github/assets/pi-light.svg" height="32"></picture><br>Pi</a></td>
99
+ </tr>
100
+ </table>
164
101
 
165
102
  ## What it does
166
103
 
@@ -190,7 +127,7 @@ Set a session safety preset with `CC_SAFETY_NET_LEVEL=standard|strict|paranoid`:
190
127
  | Strict | Standard, plus blocks dynamic or unparseable commands the analyzer cannot verify safely and metadata-only discovery of built-in sensitive paths. Occasional false positives on advanced shell. |
191
128
  | Paranoid | Strict, plus blocks `rm -rf` inside your project and interpreter one-liners. Expect friction; for untrusted agents or high-stakes repos. |
192
129
 
193
- Presets supply inherited defaults; `policy.json` stores only your explicit deviations — per-rule overrides, allow paths, deny paths, worktree mode, and audit retention. Environment variables can only raise protection, never lower it. The full contract is on [Modes](https://ccsafetynet.com/docs/configuration/modes), [Policy](https://ccsafetynet.com/docs/configuration/policy), and [Environment](https://ccsafetynet.com/docs/configuration/environment), or edit everything visually with the [local GUI](https://ccsafetynet.com/docs/guides/dashboard).
130
+ Presets supply inherited defaults; `policy.json` stores only your explicit deviations — per-rule overrides, allow paths, deny paths, worktree mode, and audit retention. Safety-level and capability environment variables can only raise protection, never lower it; the one deliberate relaxation is `CC_SAFETY_NET_WORKTREE`, which enables worktree mode to allow local git discards in linked worktrees. The full contract is on [Modes](https://ccsafetynet.com/docs/configuration/modes), [Policy](https://ccsafetynet.com/docs/configuration/policy), and [Environment](https://ccsafetynet.com/docs/configuration/environment), or edit everything visually with the [local GUI](https://ccsafetynet.com/docs/guides/dashboard).
194
131
 
195
132
  ## Diagnostics and tracing
196
133
 
@@ -215,6 +152,8 @@ Details: [CLI Commands](https://ccsafetynet.com/docs/reference/cli-commands) ·
215
152
 
216
153
  CC Safety Net denies a tool call before it runs; it does not enforce filesystem permissions, inspect network egress, or contain a process. Two v2 bounds worth knowing up front: the policy and sensitive-path command extractors remain primarily POSIX-oriented, so native PowerShell path expressions such as `Get-Content $HOME\.ssh\id_rsa` can evade static path extraction; and policy-file protection is a best-effort exact-path guard, not command emulation. Use operating-system permissions, a sandbox, or equivalent runtime enforcement when complete protection is required.
217
154
 
155
+ One integration-specific bound: Codex's unified exec path, the default on macOS and Linux, sends a hook payload when a command starts a session but none for `write_stdin`. Text the model types into an already-running interactive session is therefore never inspected and never audited — only the command that opened the session is. The host emits no event for that call, so no adapter change can close it.
156
+
218
157
  The full residual-risk registry lives in [SECURITY.md](SECURITY.md); the practical consequences are on [Known Limitations](https://ccsafetynet.com/docs/guides/known-limitations).
219
158
 
220
159
  ## Upgrading from an older version
@@ -226,7 +165,7 @@ npx -y cc-safety-net@latest update
226
165
  ```
227
166
 
228
167
  > [!WARNING]
229
- > If you previously defined custom rules in a legacy inline config (`.safety-net.json` or `~/.cc-safety-net/config.json`), those files are **no longer loaded at runtime** and **their rules are not enforcing anything**. Nothing is blocked, so you will not notice this from normal use — the commands those rules used to block now run. Run `npx -y cc-safety-net rule migrate` to convert them to the rulebook layout, then `npx -y cc-safety-net doctor` to confirm the runtime is `ready`. See the [migration guide](https://ccsafetynet.com/docs/configuration/custom-rules#migration-from-legacy-config).
168
+ > If you previously defined custom rules in a legacy inline config (`.safety-net.json` or `~/.cc-safety-net/config.json`), those files are **no longer loaded at runtime** and **their rules are not enforcing anything**. Nothing is blocked, so you will not notice this from normal use — the commands those rules used to block now run. Run `npx -y cc-safety-net rule migrate` to convert them to the rulebook layout, then `npx -y cc-safety-net doctor` to confirm the runtime is `ready`. See the [migration guide](https://ccsafetynet.com/docs/configuration/custom-rules#migrate-legacy-configuration).
230
169
 
231
170
  ## Full documentation
232
171
 
@@ -244,10 +183,10 @@ All details live on the docs site at **[ccsafetynet.com/docs](https://ccsafetyne
244
183
 
245
184
  See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.
246
185
 
247
- Generated distribution ownership is intentionally narrow. Only `dist/index.js`,
248
- `dist/index.d.ts`, `dist/bin/cc-safety-net.js`, and `dist/pi/index.js` are tracked. Run
249
- `bun run verify:build`, `bun run verify:package`, and `bun run verify:repository-plugin` when
250
- changing packaging, integrations, or release automation.
186
+ The generated distribution is committed: all 11 files under `dist/` are tracked — the library
187
+ bundle and its type declarations, the CLI entrypoint, the shared chunks, the vendored Zod copy,
188
+ and the Pi, Amp and OpenClaw adapter files. Run `bun run verify:package` and
189
+ `bun run verify:repository-plugin` when changing packaging, integrations, or release automation.
251
190
 
252
191
  ## License
253
192