@agenttrail/guardrails 0.0.2 → 0.2.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 +20 -5
- package/dist/{chunk-IQBU26ZF.js → chunk-3NDBRXP3.js} +1381 -214
- package/dist/chunk-3NDBRXP3.js.map +1 -0
- package/dist/{chunk-AUGYGUPX.js → chunk-FTTMZCDH.js} +2 -2
- package/dist/chunk-FTTMZCDH.js.map +1 -0
- package/dist/guardrails.cjs +1380 -213
- package/dist/guardrails.cjs.map +1 -1
- package/dist/guardrails.d.cts +100 -14
- package/dist/guardrails.d.ts +100 -14
- package/dist/guardrails.js +7 -1
- package/dist/index.cjs +1381 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -2
- package/dist/schema.cjs +1 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +9 -4
- package/dist/schema.d.ts +9 -4
- package/dist/schema.js +1 -1
- package/package.json +10 -1
- package/dist/chunk-AUGYGUPX.js.map +0 -1
- package/dist/chunk-IQBU26ZF.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<!-- cspell:words kubeconfig -->
|
|
1
|
+
<!-- cspell:words exfiltration kubeconfig -->
|
|
2
2
|
|
|
3
3
|
# @agenttrail/guardrails
|
|
4
4
|
|
|
5
5
|
**A library of rules that spot dangerous commands before an AI coding agent runs them.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
74 rules, grouped into 11 packs. Apache-2.0.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -81,7 +81,7 @@ Reading the fields:
|
|
|
81
81
|
| `match` | The condition. `any_of` means "any one of these is enough". |
|
|
82
82
|
| `fixtures` | Examples that must match, and examples that must not. |
|
|
83
83
|
|
|
84
|
-
## The
|
|
84
|
+
## The eleven packs
|
|
85
85
|
|
|
86
86
|
A rule is filed by **the harm it prevents**, never by the technique it uses to spot it.
|
|
87
87
|
|
|
@@ -97,9 +97,12 @@ protection, which they never asked to turn off and would not know they had.
|
|
|
97
97
|
| `prod-infra` | 8 | Changing running infrastructure — Terraform, Kubernetes, Helm, cloud deletes, a deploy that names production. |
|
|
98
98
|
| `secret-exposure` | 10 | Credentials and sensitive data leaving where they live. Mostly `warn`: reading a secret is a normal part of a normal day. |
|
|
99
99
|
| `rce-supply-chain` | 6 | Running code nobody reviewed — pipe-to-shell, a remote runner, a redirected registry, TLS verification off. |
|
|
100
|
-
| `safety-bypass` |
|
|
100
|
+
| `safety-bypass` | 7 | Turning off a check somebody installed on purpose, or erasing the record of it — `--no-verify`, `--admin` merge, hooks disabled, host-key checking off, history and log purges, forged terminal output. |
|
|
101
101
|
| `privilege-supply-chain` | 6 | Gaining reach or handing it out — `sudo` writes, `chmod 777`, IAM grants, persistence, publishing, new dependencies. |
|
|
102
102
|
| `file-scope` | 4 | The agent wrote somewhere it had no business writing — its own config, the machine, git's internals, the CI definition. |
|
|
103
|
+
| `agent-context` | 6 | The agent changing what it is or what it knows — its standing instructions, its memory, its skills and commands, its MCP servers — or starting more agents, or switching another agent's approvals off. |
|
|
104
|
+
| `test-integrity` | 6 | The agent making its work look successful — deleting a test, weakening a runner's configuration, accepting every snapshot, switching a coverage gate off, silencing failures in bulk, or telling CI not to run. |
|
|
105
|
+
| `exfiltration` | 4 | Moving data off the machine or opening a way in — a reverse shell, a public tunnel, a file upload, a paste service. Command channel only. |
|
|
103
106
|
|
|
104
107
|
Pack names appear in user config files, so renaming one is a breaking change, not a tidy-up.
|
|
105
108
|
|
|
@@ -171,6 +174,18 @@ At most four quoted arguments are recognised. A carrier that can be made to exec
|
|
|
171
174
|
the checker does not have. And an MCP tool whose input carries the same text is not exempt either,
|
|
172
175
|
because exempting a JSON blob would exempt a shell-running MCP server along with it.
|
|
173
176
|
|
|
177
|
+
**MCP coverage.** A command rule fires on `Bash`, `PowerShell` *and* any `mcp__*` tool: the guard hands
|
|
178
|
+
the checker an MCP call's serialized `tool_input` as the same command text every command rule reads, so
|
|
179
|
+
a command shape run through an MCP server — `{"command":"rm -rf /"}` — is caught, not ignored. Two
|
|
180
|
+
honest limits follow from that. First, a rule whose pattern is anchored to the start of the command
|
|
181
|
+
(`^…` or a command-position class) may not fire inside the JSON, where the shape sits after a `"`
|
|
182
|
+
rather than at a command boundary; the `\b`-anchored rules — most of the corpus — do fire. Second, the
|
|
183
|
+
quoted-mention exemptions are shell-only, so an MCP payload that merely *names* a command in a text
|
|
184
|
+
field (`{"title":"fix the rm -rf / bug"}`) is matched the same as one that runs it — a JSON blob cannot
|
|
185
|
+
be told apart from a shell-running MCP server. File rules match by path on whichever file tool a client
|
|
186
|
+
uses. No rule is shell-only by design; a rule that does not reach the MCP channel does so because its
|
|
187
|
+
pattern, not its label, does not match the serialized shape.
|
|
188
|
+
|
|
174
189
|
## What these rules deliberately do not catch
|
|
175
190
|
|
|
176
191
|
Stated here rather than discovered later. Every one is a real limit of the format, not something
|
|
@@ -282,7 +297,7 @@ Use the first when you want to *apply* rules, and the second when you want to *v
|
|
|
282
297
|
writing.
|
|
283
298
|
|
|
284
299
|
They are separate because the guard starts a fresh process on **every single command** an agent runs,
|
|
285
|
-
under a ten-second ceiling. It cannot afford to load a validator it never calls, or to re-check
|
|
300
|
+
under a ten-second ceiling. It cannot afford to load a validator it never calls, or to re-check 74
|
|
286
301
|
rules that were already checked before release.
|
|
287
302
|
|
|
288
303
|
## Where these rules came from
|