@node9/proxy 1.0.13 → 1.0.14
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 +117 -119
- package/dist/cli.js +736 -360
- package/dist/cli.mjs +731 -355
- package/dist/index.js +441 -123
- package/dist/index.mjs +441 -123
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ While others try to _guess_ if a prompt is malicious (Semantic Security), Node9
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
## ⚡ Key
|
|
32
|
+
## ⚡ Key Features
|
|
33
33
|
|
|
34
34
|
### 🏁 The Multi-Channel Race Engine
|
|
35
35
|
|
|
@@ -42,7 +42,7 @@ Node9 initiates a **Concurrent Race** across all enabled channels. The first cha
|
|
|
42
42
|
|
|
43
43
|
### 🧠 AI Negotiation Loop
|
|
44
44
|
|
|
45
|
-
Node9 doesn't just "cut the wire." When a command is blocked, it injects a **Structured Negotiation Prompt** back into the AI
|
|
45
|
+
Node9 doesn't just "cut the wire." When a command is blocked, it injects a **Structured Negotiation Prompt** back into the AI's context window. This teaches the AI why it was stopped and instructs it to pivot to a safer alternative.
|
|
46
46
|
|
|
47
47
|
### ⏪ Shadow Git Snapshots (Auto-Undo)
|
|
48
48
|
|
|
@@ -56,41 +56,11 @@ node9 undo
|
|
|
56
56
|
node9 undo --steps 3
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Example output:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
⏪ Node9 Undo
|
|
63
|
-
Tool: str_replace_based_edit_tool → src/app.ts
|
|
64
|
-
When: 2m ago
|
|
65
|
-
Dir: /home/user/my-project
|
|
66
|
-
|
|
67
|
-
--- src/app.ts (snapshot)
|
|
68
|
-
+++ src/app.ts (current)
|
|
69
|
-
@@ -1,4 +1,6 @@
|
|
70
|
-
-const x = 1;
|
|
71
|
-
+const x = 99;
|
|
72
|
-
+const y = "hello";
|
|
73
|
-
|
|
74
|
-
Revert to this snapshot? [y/N]
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Node9 keeps the last 10 snapshots. Snapshots are only taken for file-writing tools (`write_file`, `edit_file`, `str_replace_based_edit_tool`, `create_file`) — not for read-only or shell commands.
|
|
78
|
-
|
|
79
|
-
### 🌊 The Resolution Waterfall
|
|
80
|
-
|
|
81
|
-
Security posture is resolved using a strict 5-tier waterfall:
|
|
82
|
-
|
|
83
|
-
1. **Env Vars:** Session-level overrides (e.g., `NODE9_PAUSED=1`).
|
|
84
|
-
2. **Cloud (SaaS):** Global organization "Locks" that cannot be bypassed locally.
|
|
85
|
-
3. **Project Config:** Repository-specific rules (`node9.config.json`).
|
|
86
|
-
4. **Global Config:** Personal UI preferences (`~/.node9/config.json`).
|
|
87
|
-
5. **Defaults:** The built-in safety net.
|
|
88
|
-
|
|
89
59
|
---
|
|
90
60
|
|
|
91
61
|
## 🎮 Try it Live
|
|
92
62
|
|
|
93
|
-
No install needed — test Node9's
|
|
63
|
+
No install needed — test Node9's policy engine against real commands in the browser:
|
|
94
64
|
|
|
95
65
|
[](https://huggingface.co/spaces/Node9ai/node9-security-demo)
|
|
96
66
|
|
|
@@ -106,19 +76,52 @@ brew install node9
|
|
|
106
76
|
# Or via npm
|
|
107
77
|
npm install -g @node9/proxy
|
|
108
78
|
|
|
109
|
-
# 1.
|
|
79
|
+
# 1. Wire Node9 to your agent
|
|
110
80
|
node9 setup # interactive menu — picks the right agent for you
|
|
111
81
|
node9 addto claude # or wire directly
|
|
112
82
|
node9 addto gemini
|
|
113
83
|
|
|
114
|
-
# 2.
|
|
115
|
-
node9
|
|
84
|
+
# 2. Enable shields for the services you use
|
|
85
|
+
node9 shield enable postgres
|
|
86
|
+
node9 shield enable aws
|
|
116
87
|
|
|
117
88
|
# 3. Verify everything is wired correctly
|
|
118
89
|
node9 doctor
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
119
93
|
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
## 🛡️ How Protection Works
|
|
95
|
+
|
|
96
|
+
Node9 has two layers of protection. You get Layer 1 automatically. Layer 2 is one command per service.
|
|
97
|
+
|
|
98
|
+
### Layer 1 — Core Protection (Always On)
|
|
99
|
+
|
|
100
|
+
Built into the binary. Zero configuration required. Protects the tools every developer uses.
|
|
101
|
+
|
|
102
|
+
| What it protects | Example blocked action |
|
|
103
|
+
| :--------------- | :------------------------------------------------------ |
|
|
104
|
+
| **Git** | `git push --force`, `git reset --hard`, `git clean -fd` |
|
|
105
|
+
| **Shell** | `curl ... \| bash`, `sudo` commands |
|
|
106
|
+
| **SQL** | `DELETE` / `UPDATE` without a `WHERE` clause |
|
|
107
|
+
| **Filesystem** | `rm -rf` targeting home directory |
|
|
108
|
+
|
|
109
|
+
### Layer 2 — Shields (Opt-in, Per Service)
|
|
110
|
+
|
|
111
|
+
Shields add protection for specific infrastructure and services — only relevant if you actually use them.
|
|
112
|
+
|
|
113
|
+
| Shield | What it protects |
|
|
114
|
+
| :----------- | :---------------------------------------------------------------------------- |
|
|
115
|
+
| `postgres` | Blocks `DROP TABLE`, `TRUNCATE`, `DROP COLUMN`; reviews `GRANT`/`REVOKE` |
|
|
116
|
+
| `github` | Blocks `gh repo delete`; reviews remote branch deletion |
|
|
117
|
+
| `aws` | Blocks S3 bucket deletion, EC2 termination; reviews IAM changes, RDS deletion |
|
|
118
|
+
| `filesystem` | Reviews `chmod 777`, writes to `/etc/` |
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
node9 shield enable postgres # protect your database
|
|
122
|
+
node9 shield enable aws # protect your cloud infrastructure
|
|
123
|
+
node9 shield list # see all available shields
|
|
124
|
+
node9 shield status # see what's currently active
|
|
122
125
|
```
|
|
123
126
|
|
|
124
127
|
---
|
|
@@ -133,78 +136,55 @@ node9 status
|
|
|
133
136
|
|
|
134
137
|
---
|
|
135
138
|
|
|
136
|
-
##
|
|
139
|
+
## 🔗 Configuration Precedence
|
|
140
|
+
|
|
141
|
+
Node9 merges configuration from multiple sources in priority order. Higher tiers win:
|
|
142
|
+
|
|
143
|
+
| Tier | Source | Notes |
|
|
144
|
+
| :--- | :------------------------ | :-------------------------------------------------------- |
|
|
145
|
+
| 1 | **Environment variables** | `NODE9_MODE=strict` overrides everything |
|
|
146
|
+
| 2 | **Cloud / Org policy** | Set in the Node9 dashboard — cannot be overridden locally |
|
|
147
|
+
| 3 | **Project config** | `node9.config.json` in the working directory |
|
|
148
|
+
| 4 | **Global config** | `~/.node9/config.json` |
|
|
149
|
+
| 5 | **Built-in defaults** | Always active, no config needed |
|
|
150
|
+
|
|
151
|
+
**Settings** (mode, approvers, timeouts) follow the table above — higher tier wins. A project config overrides a global config.
|
|
152
|
+
|
|
153
|
+
**Smart rules** work differently. All layers are concatenated into a single ordered list and evaluated first-match-wins:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
built-in defaults → global config → project config → shields → advisory defaults
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Because built-in `block` rules sit at the front of this list, they always fire before any user-defined `allow` rule. **A project or global config cannot bypass Layer 1 protection.** Within the user layers, a project `block` rule fires before a shield `block` rule — so project policy can tighten or selectively override a shield.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## ⚙️ Custom Rules (Advanced)
|
|
164
|
+
|
|
165
|
+
Most users never need this. If you need protection beyond Layer 1 and the available shields, add **Smart Rules** to `node9.config.json` in your project root or `~/.node9/config.json` globally.
|
|
137
166
|
|
|
138
|
-
Rules
|
|
167
|
+
Smart Rules match on **raw tool arguments** using structured conditions:
|
|
139
168
|
|
|
140
169
|
```json
|
|
141
170
|
{
|
|
142
|
-
"settings": {
|
|
143
|
-
"mode": "standard",
|
|
144
|
-
"enableUndo": true,
|
|
145
|
-
"approvalTimeoutMs": 30000,
|
|
146
|
-
"approvers": {
|
|
147
|
-
"native": true,
|
|
148
|
-
"browser": true,
|
|
149
|
-
"cloud": true,
|
|
150
|
-
"terminal": true
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
171
|
"policy": {
|
|
154
|
-
"sandboxPaths": ["/tmp/**", "**/test-results/**"],
|
|
155
|
-
"dangerousWords": ["drop", "destroy", "purge", "push --force"],
|
|
156
|
-
"ignoredTools": ["list_*", "get_*", "read_*"],
|
|
157
|
-
"toolInspection": {
|
|
158
|
-
"bash": "command",
|
|
159
|
-
"postgres:query": "sql"
|
|
160
|
-
},
|
|
161
|
-
"rules": [
|
|
162
|
-
{ "action": "rm", "allowPaths": ["**/node_modules/**", "dist/**"] },
|
|
163
|
-
{ "action": "push", "blockPaths": ["**"] }
|
|
164
|
-
],
|
|
165
172
|
"smartRules": [
|
|
166
173
|
{
|
|
167
|
-
"name": "
|
|
168
|
-
"tool": "
|
|
174
|
+
"name": "block-prod-deploy",
|
|
175
|
+
"tool": "bash",
|
|
169
176
|
"conditions": [
|
|
170
|
-
{ "field": "
|
|
171
|
-
{ "field": "sql", "op": "notMatches", "value": "\\bWHERE\\b", "flags": "i" }
|
|
177
|
+
{ "field": "command", "op": "matches", "value": "kubectl.*--namespace=production" }
|
|
172
178
|
],
|
|
173
|
-
"verdict": "
|
|
174
|
-
"reason": "
|
|
179
|
+
"verdict": "block",
|
|
180
|
+
"reason": "Deploying to production requires a manual release process"
|
|
175
181
|
}
|
|
176
182
|
]
|
|
177
183
|
}
|
|
178
184
|
}
|
|
179
185
|
```
|
|
180
186
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
| Key | Default | Description |
|
|
184
|
-
| :------------------- | :----------- | :----------------------------------------------------------- |
|
|
185
|
-
| `mode` | `"standard"` | `standard` \| `strict` \| `audit` |
|
|
186
|
-
| `enableUndo` | `true` | Take git snapshots before every AI file edit |
|
|
187
|
-
| `approvalTimeoutMs` | `0` | Auto-deny after N ms if no human responds (0 = wait forever) |
|
|
188
|
-
| `approvers.native` | `true` | OS-native popup |
|
|
189
|
-
| `approvers.browser` | `true` | Browser dashboard (`node9 daemon`) |
|
|
190
|
-
| `approvers.cloud` | `true` | Slack / SaaS approval |
|
|
191
|
-
| `approvers.terminal` | `true` | `[Y/n]` prompt in terminal |
|
|
192
|
-
|
|
193
|
-
### 🧠 Smart Rules
|
|
194
|
-
|
|
195
|
-
Smart rules match on **raw tool arguments** using structured conditions — more powerful than `dangerousWords` or `rules`, which only see extracted tokens.
|
|
196
|
-
|
|
197
|
-
```json
|
|
198
|
-
{
|
|
199
|
-
"name": "curl-pipe-to-shell",
|
|
200
|
-
"tool": "bash",
|
|
201
|
-
"conditions": [{ "field": "command", "op": "matches", "value": "curl.+\\|.*(bash|sh)" }],
|
|
202
|
-
"verdict": "block",
|
|
203
|
-
"reason": "curl piped to shell — remote code execution risk"
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**Fields:**
|
|
187
|
+
**Smart Rule fields:**
|
|
208
188
|
|
|
209
189
|
| Field | Description |
|
|
210
190
|
| :-------------- | :----------------------------------------------------------------------------------- |
|
|
@@ -216,33 +196,50 @@ Smart rules match on **raw tool arguments** using structured conditions — more
|
|
|
216
196
|
|
|
217
197
|
**Condition operators:**
|
|
218
198
|
|
|
219
|
-
| `op`
|
|
220
|
-
|
|
|
221
|
-
| `matches`
|
|
222
|
-
| `notMatches`
|
|
223
|
-
| `contains`
|
|
224
|
-
| `notContains`
|
|
225
|
-
| `exists`
|
|
226
|
-
| `notExists`
|
|
199
|
+
| `op` | Meaning |
|
|
200
|
+
| :--------------- | :------------------------------------------------------------------------- |
|
|
201
|
+
| `matches` | Field value matches regex (`value` = pattern, `flags` = e.g. `"i"`) |
|
|
202
|
+
| `notMatches` | Field value does not match regex (`value` = pattern, `flags` optional) |
|
|
203
|
+
| `contains` | Field value contains substring |
|
|
204
|
+
| `notContains` | Field value does not contain substring |
|
|
205
|
+
| `exists` | Field is present and non-empty |
|
|
206
|
+
| `notExists` | Field is absent or empty |
|
|
207
|
+
| `matchesGlob` | Field value matches a glob pattern (`value` = e.g. `"**/node_modules/**"`) |
|
|
208
|
+
| `notMatchesGlob` | Field value does not match a glob pattern |
|
|
227
209
|
|
|
228
210
|
The `field` key supports dot-notation for nested args: `"params.query.sql"`.
|
|
229
211
|
|
|
230
|
-
|
|
212
|
+
Use `node9 explain <tool> <args>` to dry-run any tool call and see exactly which rule would trigger.
|
|
213
|
+
|
|
214
|
+
### Settings
|
|
231
215
|
|
|
232
216
|
```json
|
|
233
217
|
{
|
|
234
|
-
"
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
218
|
+
"settings": {
|
|
219
|
+
"mode": "standard",
|
|
220
|
+
"enableUndo": true,
|
|
221
|
+
"approvalTimeoutMs": 30000,
|
|
222
|
+
"approvers": {
|
|
223
|
+
"native": true,
|
|
224
|
+
"browser": true,
|
|
225
|
+
"cloud": true,
|
|
226
|
+
"terminal": true
|
|
227
|
+
}
|
|
228
|
+
}
|
|
242
229
|
}
|
|
243
230
|
```
|
|
244
231
|
|
|
245
|
-
|
|
232
|
+
| Key | Default | Description |
|
|
233
|
+
| :------------------- | :----------- | :----------------------------------------------------------- |
|
|
234
|
+
| `mode` | `"standard"` | `standard` \| `strict` \| `audit` |
|
|
235
|
+
| `enableUndo` | `true` | Take git snapshots before every AI file edit |
|
|
236
|
+
| `approvalTimeoutMs` | `0` | Auto-deny after N ms if no human responds (0 = wait forever) |
|
|
237
|
+
| `approvers.native` | `true` | OS-native popup |
|
|
238
|
+
| `approvers.browser` | `true` | Browser dashboard (`node9 daemon`) |
|
|
239
|
+
| `approvers.cloud` | `true` | Slack / SaaS approval |
|
|
240
|
+
| `approvers.terminal` | `true` | `[Y/n]` prompt in terminal |
|
|
241
|
+
|
|
242
|
+
---
|
|
246
243
|
|
|
247
244
|
## 🖥️ CLI Reference
|
|
248
245
|
|
|
@@ -253,14 +250,13 @@ Use `node9 explain <tool> <args>` to dry-run any tool call and see exactly which
|
|
|
253
250
|
| `node9 init` | Create default `~/.node9/config.json` |
|
|
254
251
|
| `node9 status` | Show current protection status and active rules |
|
|
255
252
|
| `node9 doctor` | Health check — verifies binaries, config, credentials, and all agent hooks |
|
|
253
|
+
| `node9 shield <cmd>` | Manage shields (`enable`, `disable`, `list`, `status`) |
|
|
256
254
|
| `node9 explain <tool> [args]` | Trace the policy waterfall for a given tool call (dry-run, no approval prompt) |
|
|
257
255
|
| `node9 undo [--steps N]` | Revert the last N AI file edits using shadow Git snapshots |
|
|
258
256
|
| `node9 check` | Called by agent hooks; evaluates a pending tool call and exits 0 (allow) or 1 (block) |
|
|
259
257
|
|
|
260
258
|
### `node9 doctor`
|
|
261
259
|
|
|
262
|
-
Runs a full self-test and exits 1 if any required check fails:
|
|
263
|
-
|
|
264
260
|
```
|
|
265
261
|
Node9 Doctor v1.2.0
|
|
266
262
|
────────────────────────────────────────
|
|
@@ -283,7 +279,7 @@ All checks passed ✅
|
|
|
283
279
|
|
|
284
280
|
### `node9 explain`
|
|
285
281
|
|
|
286
|
-
Dry-runs the policy engine and prints exactly which rule
|
|
282
|
+
Dry-runs the policy engine and prints exactly which rule would fire — useful for debugging:
|
|
287
283
|
|
|
288
284
|
```bash
|
|
289
285
|
node9 explain bash '{"command":"rm -rf /tmp/build"}'
|
|
@@ -294,9 +290,6 @@ Policy Waterfall for: bash
|
|
|
294
290
|
──────────────────────────────────────────────
|
|
295
291
|
Tier 1 · Cloud Org Policy SKIP (no org policy loaded)
|
|
296
292
|
Tier 2 · Dangerous Words BLOCK ← matched "rm -rf"
|
|
297
|
-
Tier 3 · Path Block –
|
|
298
|
-
Tier 4 · Inline Exec –
|
|
299
|
-
Tier 5 · Rule Match –
|
|
300
293
|
──────────────────────────────────────────────
|
|
301
294
|
Verdict: BLOCK (dangerous word: rm -rf)
|
|
302
295
|
```
|
|
@@ -324,6 +317,11 @@ A corporate policy has locked this action. You must click the "Approve" button i
|
|
|
324
317
|
- [x] **Native OS Dialogs** (Sub-second approval via Mac/Win/Linux system windows)
|
|
325
318
|
- [x] **Shadow Git Snapshots** (1-click Undo for AI hallucinations)
|
|
326
319
|
- [x] **Identity-Aware Execution** (Differentiates between Human vs. AI risk levels)
|
|
320
|
+
- [x] **Shield Templates** (`node9 shield enable <service>` — one-click protection for Postgres, GitHub, AWS)
|
|
321
|
+
- [ ] **Content Scanner / DLP** (Detect and block secrets like AWS keys and Bearer tokens in-flight)
|
|
322
|
+
- [ ] **Universal MCP Gateway** (Standalone security tunnel for LangChain, CrewAI, and any agent without native hooks)
|
|
323
|
+
- [ ] **Cursor & Windsurf Hook** (Native hook support for AI-first IDEs)
|
|
324
|
+
- [ ] **VS Code Extension** (Approval requests in a native sidebar — no more OS popups)
|
|
327
325
|
- [ ] **Execution Sandboxing** (Simulate dangerous commands in a virtual FS before applying)
|
|
328
326
|
- [ ] **Multi-Admin Quorum** (Require 2+ human signatures for high-stakes production actions)
|
|
329
327
|
- [ ] **SOC2 Tamper-proof Audit Trail** (Cryptographically signed, cloud-managed logs)
|