cc-safety-net 2.0.10 → 2.0.11
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 +34 -36
- package/dist/amp/cc-safety-net/index.ts +42 -42
- package/dist/bin/cc-safety-net.js +103 -105
- package/dist/chunks/index-9dxxkq16.js +62 -0
- package/dist/index.js +1 -1
- package/dist/openclaw/cc-safety-net/index.js +42 -42
- package/dist/openclaw/cc-safety-net/openclaw.plugin.json +1 -1
- package/dist/openclaw/cc-safety-net/package.json +1 -1
- package/dist/pi/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/index-dnak4vk0.js +0 -62
package/README.md
CHANGED
|
@@ -19,32 +19,32 @@
|
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
-
CC Safety Net
|
|
22
|
+
CC Safety Net is short for Coding CLI Safety Net. It is a PreToolUse hook that blocks destructive commands and access to secrets such as SSH keys and `.env` files before the tool call runs. It parses what a command does, so flag reordering, shell wrappers, and interpreter one-liners cannot bypass it.
|
|
23
23
|
|
|
24
24
|
> [!NOTE]
|
|
25
|
-
> **[Full documentation →](https://ccsafetynet.com/docs)**
|
|
25
|
+
> **[Full documentation →](https://ccsafetynet.com/docs)** covers installation, configuration, reference material, guides, and the security model. This README is the short version.
|
|
26
26
|
|
|
27
27
|
## Why this exists
|
|
28
28
|
|
|
29
|
-
We
|
|
29
|
+
We built CC Safety Net after an agent [wiped hours of work](https://www.reddit.com/r/ClaudeAI/comments/1pgxckk/claude_cli_deleted_my_entire_home_directory_wiped/) with one `rm -rf ~/` or `git checkout --`. Instructions did not stop it. Rules in `CLAUDE.md` or `AGENTS.md` can guide an agent, but they cannot enforce a technical limit. CC Safety Net watches relevant tool calls and blocks destructive commands and secret access before they reach the shell. See [What is CC Safety Net](https://ccsafetynet.com/docs/introduction) for the full background.
|
|
30
30
|
|
|
31
31
|
## What's new in v2.0.0
|
|
32
32
|
|
|
33
33
|
> [!TIP]
|
|
34
|
-
> **Already running v1?**
|
|
34
|
+
> **Already running v1?** Run `npx -y cc-safety-net@latest update` to upgrade every installed integration to v2. If you defined custom rules under v1, also read [Upgrading from an older version](#upgrading-from-an-older-version).
|
|
35
35
|
|
|
36
|
-
- **
|
|
37
|
-
- **Secret protection
|
|
38
|
-
- **Always-on
|
|
39
|
-
- **Safety presets
|
|
40
|
-
- **Policy GUI
|
|
41
|
-
- **Universal installer
|
|
42
|
-
- **Command-decision audit trail
|
|
43
|
-
- **
|
|
36
|
+
- **Evaluation engine.** A canonical command IR, policy snapshots that remain immutable at every nested level, and an ordered guard pipeline now support decision tracing through `explain`.
|
|
37
|
+
- **Secret protection.** Built-in rules block content access to SSH keys, `.env` files, cloud credentials, and coding-CLI credential stores through shell commands and file tools.
|
|
38
|
+
- **Always-on protections.** Every mode blocks recursive deletion of root or home, Git metadata changes to the `.git` control plane, hooks, worktrees, or submodules, and changes to the user policy file. Overrides do not disable these rules.
|
|
39
|
+
- **Safety presets.** The `standard`, `strict`, and `paranoid` levels support per-rule overrides and trusted delete allow-paths. Safety-level and capability environment variables can only raise protection. `CC_SAFETY_NET_WORKTREE` is the one exception. It allows local Git discards in linked worktrees.
|
|
40
|
+
- **Policy GUI.** `cc-safety-net gui` runs a local, token-authenticated editor with a live preset preview.
|
|
41
|
+
- **Universal installer.** Interactive `install` and `uninstall` commands support all twelve coding CLIs. The `update` command updates installed integrations.
|
|
42
|
+
- **Command-decision audit trail.** CC Safety Net records allowed and blocked decisions in local per-project JSONL. It redacts secrets, keeps records for 30 days by default, and shows them through `cc-safety-net logs`.
|
|
43
|
+
- **Threat model.** [SECURITY.md](SECURITY.md) defines the mode contract and resource limits. Its residual-risk registry records decisions for bypass families.
|
|
44
44
|
|
|
45
45
|
## Quick start
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
You need Node.js 18 or higher.
|
|
48
48
|
|
|
49
49
|
Run the interactive selector to install CC Safety Net into one or more installed coding CLIs:
|
|
50
50
|
|
|
@@ -58,8 +58,8 @@ To update every installed integration:
|
|
|
58
58
|
npx -y cc-safety-net@latest update
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
Keep the `@latest` qualifier. A bare `cc-safety-net` spec can run an older cached
|
|
62
|
+
copy from the npx cache instead of the current release.
|
|
63
63
|
|
|
64
64
|
To remove integrations interactively:
|
|
65
65
|
|
|
@@ -76,7 +76,7 @@ ccsn doctor
|
|
|
76
76
|
|
|
77
77
|
## Supported coding CLIs
|
|
78
78
|
|
|
79
|
-
CC Safety Net
|
|
79
|
+
CC Safety Net supports the coding agent CLIs below on Windows, macOS, and Linux. Automated tests cover the analyzer and some Windows integrations. Other hosts have best-effort Windows support that has not been tested. Amp documents macOS, Linux, and WSL, but not native Windows.
|
|
80
80
|
|
|
81
81
|
<table align="center">
|
|
82
82
|
<tr>
|
|
@@ -103,23 +103,23 @@ CC Safety Net works across all coding agent CLIs on **Windows, macOS, and Linux*
|
|
|
103
103
|
|
|
104
104
|
| Capability | What it catches |
|
|
105
105
|
|---|---|
|
|
106
|
-
| **Semantic command analysis** | `rm -rf` on destructive targets, `git reset --hard`, `git checkout --`, `git push --force`, `git stash clear`, `git clean -f`, unsafe `find -delete`, `dd
|
|
107
|
-
| **Shell wrapper detection** |
|
|
108
|
-
| **Interpreter one-liners** |
|
|
109
|
-
| **Fail-closed by default** |
|
|
110
|
-
| **Secret protection** |
|
|
111
|
-
| **Custom rules via rulebooks** |
|
|
112
|
-
| **Audit logging** |
|
|
106
|
+
| **Semantic command analysis** | Detects the intent of `rm -rf` on destructive targets, `git reset --hard`, `git checkout --`, `git push --force`, `git stash clear`, `git clean -f`, unsafe `find -delete`, `dd`, `mkfs`, and `shred`. It allows `git checkout -b feature` but blocks `git checkout -- file`. |
|
|
107
|
+
| **Shell wrapper detection** | Finds destructive commands inside `bash -c`, `sh -c`, and similar wrappers. It analyzes nested wrappers up to 10 levels deep. |
|
|
108
|
+
| **Interpreter one-liners** | Finds destructive code in `python -c`, `node -e`, `ruby -e`, and `perl -e` one-liners such as `os.system("rm -rf /")`. |
|
|
109
|
+
| **Fail-closed by default** | Blocks malformed hook input and, in strict mode, commands it cannot parse. Invalid configuration never blocks. CC Safety Net drops an unverifiable rule source and uses protective defaults when it cannot read `policy.json`. It reports these states in block messages, `doctor`, the status line, and the GUI. |
|
|
110
|
+
| **Secret protection** | Blocks content access to SSH keys, `.env` files, `~/.aws`, Kubernetes, Docker, and gcloud configuration, and coding-CLI credential stores. The rules apply to shell commands and read, edit, write, and search tools. |
|
|
111
|
+
| **Custom rules via rulebooks** | Lets you add blocking rules at user or project scope. CC Safety Net pins rulebooks fetched from GitHub by SHA-256 digest. |
|
|
112
|
+
| **Audit logging** | Writes allowed and blocked command decisions to local per-project JSONL, redacts secrets, and keeps records for 30 days by default. Browse them with `npx cc-safety-net logs`, or review them in the Activity view of `npx cc-safety-net gui`. |
|
|
113
113
|
|
|
114
114
|
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).
|
|
115
115
|
|
|
116
116
|
## Why not just use a sandbox?
|
|
117
117
|
|
|
118
|
-
A workspace-writable sandbox still permits `git reset --hard`, `git push --force`, and `rm -rf .`
|
|
118
|
+
A workspace-writable sandbox still permits `git reset --hard`, `git push --force`, and `rm -rf .` inside the project directory. The operating system sees writes to an allowed path. A sandbox limits where a process can write. CC Safety Net blocks destructive operations inside that allowed area. Use both. See [vs Sandboxing](https://ccsafetynet.com/docs/guides/vs-sandboxing).
|
|
119
119
|
|
|
120
120
|
## Safety presets
|
|
121
121
|
|
|
122
|
-
Set a session safety preset with `
|
|
122
|
+
Set a session safety preset with the GUI `npx cc-safety-net gui` then navigate to the policy tab:
|
|
123
123
|
|
|
124
124
|
| Preset | Effect |
|
|
125
125
|
|---|---|
|
|
@@ -127,8 +127,6 @@ Set a session safety preset with `CC_SAFETY_NET_LEVEL=standard|strict|paranoid`:
|
|
|
127
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. |
|
|
128
128
|
| Paranoid | Strict, plus blocks `rm -rf` inside your project and interpreter one-liners. Expect friction; for untrusted agents or high-stakes repos. |
|
|
129
129
|
|
|
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).
|
|
131
|
-
|
|
132
130
|
## Diagnostics and tracing
|
|
133
131
|
|
|
134
132
|
```bash
|
|
@@ -144,17 +142,17 @@ npx cc-safety-net logs
|
|
|
144
142
|
npx cc-safety-net gui
|
|
145
143
|
```
|
|
146
144
|
|
|
147
|
-
`doctor`, `explain`, and `logs` support `--json` for machine-readable output. The audit trail records command decisions
|
|
145
|
+
`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. Invalid configuration never blocks your agent. CC Safety Net drops unverifiable rule sources and reports each degraded state in the next block message, `doctor`, the status line, and the GUI banner.
|
|
148
146
|
|
|
149
147
|
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).
|
|
150
148
|
|
|
151
149
|
## Limitations
|
|
152
150
|
|
|
153
|
-
CC Safety Net denies a tool call before it runs
|
|
151
|
+
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 limits matter. First, the policy and sensitive-path command extractors remain mainly POSIX-oriented. Native PowerShell path expressions such as `Get-Content $HOME\.ssh\id_rsa` can evade static path extraction. Second, policy-file protection is a best-effort exact-path guard. It does not emulate commands. Use operating-system permissions, a sandbox, or equivalent runtime controls when you need complete protection.
|
|
154
152
|
|
|
155
|
-
|
|
153
|
+
Codex has one integration-specific limit. Its unified exec path is the default on macOS and Linux. 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.
|
|
156
154
|
|
|
157
|
-
|
|
155
|
+
[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.
|
|
158
156
|
|
|
159
157
|
## Upgrading from an older version
|
|
160
158
|
|
|
@@ -165,11 +163,11 @@ npx -y cc-safety-net@latest update
|
|
|
165
163
|
```
|
|
166
164
|
|
|
167
165
|
> [!WARNING]
|
|
168
|
-
> If you
|
|
166
|
+
> 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).
|
|
169
167
|
|
|
170
168
|
## Full documentation
|
|
171
169
|
|
|
172
|
-
|
|
170
|
+
The **[ccsafetynet.com/docs](https://ccsafetynet.com/docs)** site contains the full documentation:
|
|
173
171
|
|
|
174
172
|
| Area | Pages |
|
|
175
173
|
|---|---|
|
|
@@ -181,11 +179,11 @@ All details live on the docs site at **[ccsafetynet.com/docs](https://ccsafetyne
|
|
|
181
179
|
|
|
182
180
|
## Development
|
|
183
181
|
|
|
184
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
182
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to contribute to the project.
|
|
185
183
|
|
|
186
|
-
The
|
|
184
|
+
The repository tracks all 11 generated files under `dist/`. They include the library
|
|
187
185
|
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
|
|
186
|
+
and the Pi, Amp, and OpenClaw adapter files. Run `bun run verify:package` and
|
|
189
187
|
`bun run verify:repository-plugin` when changing packaging, integrations, or release automation.
|
|
190
188
|
|
|
191
189
|
## License
|