shield-llm 0.6.4 → 0.6.6
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 +140 -30
- package/dist/chunk-4QYDLRL6.js +17044 -0
- package/dist/cli.js +2874 -128
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-K3CXSNC7.js +0 -9952
package/README.md
CHANGED
|
@@ -5,22 +5,32 @@
|
|
|
5
5
|
`shield-llm` scans a chatbot (any HTTP endpoint, or an LLM provider directly)
|
|
6
6
|
against a catalogue of prompt-injection, jailbreak, data-extraction, excessive-
|
|
7
7
|
agency, RAG, supply-chain and multi-turn attacks mapped to the **OWASP LLM Top
|
|
8
|
-
10
|
|
8
|
+
10**. It produces a security score, a letter grade, and reports in JSON,
|
|
9
9
|
Markdown, SARIF, or PDF — ready for CI/CD.
|
|
10
10
|
|
|
11
|
+
It does not stop at the finding. `shield-llm fix` patches a subset of findings
|
|
12
|
+
from declarative recipes, and `shield-llm verify-claims` replays the original
|
|
13
|
+
exploit after you deploy, so a finding closes on evidence instead of on someone
|
|
14
|
+
ticking a box. See [Fix, then prove the fix](#fix-then-prove-the-fix).
|
|
15
|
+
|
|
11
16
|
## How it works (thin client)
|
|
12
17
|
|
|
13
18
|
The CLI is a thin client. It authenticates against a Shield LLM backend, pulls
|
|
14
|
-
the
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
the attack catalogue, sends each attack prompt to **your** target chatbot, and
|
|
20
|
+
posts the responses back to the backend, which runs an LLM judge and scores
|
|
21
|
+
them. The CLI itself contains no attack payloads and no scoring logic — so
|
|
22
|
+
adding new attacks server-side reaches every install instantly, with no upgrade.
|
|
23
|
+
|
|
24
|
+
Which OWASP LLM Top 10 edition your report is labelled with follows the attack
|
|
25
|
+
pack your instance serves, not the CLI version. An archived report keeps the
|
|
26
|
+
category names that were current on the day it ran.
|
|
19
27
|
|
|
20
28
|
> A backend connection is required. Two modes, same binary:
|
|
21
29
|
>
|
|
22
|
-
> - **
|
|
23
|
-
> - **
|
|
30
|
+
> - **Self-hosted** — your own instance via `--api-url`. This is the normal path.
|
|
31
|
+
> - **Hosted** — `https://shield-llm.com`, the default when you pass no
|
|
32
|
+
> `--api-url`. An evaluation instance, access on request; it is not open for
|
|
33
|
+
> self-service signup.
|
|
24
34
|
|
|
25
35
|
## Install
|
|
26
36
|
|
|
@@ -44,10 +54,8 @@ Set `PUPPETEER_EXECUTABLE_PATH` to use a system Chrome instead of the bundled on
|
|
|
44
54
|
## Quick start
|
|
45
55
|
|
|
46
56
|
```bash
|
|
47
|
-
# 1. Authenticate
|
|
48
|
-
shield-llm login --key
|
|
49
|
-
# self-hosted:
|
|
50
|
-
shield-llm login --key <license-key> --api-url https://shield.your-corp.com
|
|
57
|
+
# 1. Authenticate against your instance (create an API key in Settings)
|
|
58
|
+
shield-llm login --key <api-key> --api-url https://shield.your-corp.com
|
|
51
59
|
|
|
52
60
|
# 2. Generate a config for your chatbot endpoint (interactive)
|
|
53
61
|
shield-llm init
|
|
@@ -101,34 +109,128 @@ shield-llm scan --preset owasp
|
|
|
101
109
|
|
|
102
110
|
## Commands
|
|
103
111
|
|
|
104
|
-
| Command
|
|
105
|
-
|
|
|
106
|
-
| `scan`
|
|
107
|
-
| `init`
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
112
|
+
| Command | Description |
|
|
113
|
+
| ------------------- | ----------------------------------------------------------------------- |
|
|
114
|
+
| `scan` | Run a security scan against a target chatbot |
|
|
115
|
+
| `init` | Interactive wizard → generates `shield.config.json` |
|
|
116
|
+
| `validate` | Validate a `shield.config.json` without scanning |
|
|
117
|
+
| `test-connection` | Send one benign message to check your config works (no attacks) |
|
|
118
|
+
| `probe-carriers` | Check whether invisible-Unicode carriers survive your input pipeline |
|
|
119
|
+
| `report <scanId>` | Fetch a past scan from your dashboard |
|
|
120
|
+
| `retest <scanId>` | Replay a past scan's findings and record which are fixed |
|
|
121
|
+
| `fix` | Patch findings from a scan report using declarative remediation recipes |
|
|
122
|
+
| `verify-claims` | Replay every pending claim's attack family and close it, or refuse to |
|
|
123
|
+
| `attacks` | List the attack catalogue (fetched from your backend) |
|
|
124
|
+
| `presets` | List available scan presets |
|
|
125
|
+
| `tests` | List custom tests (local config and/or `--remote`) |
|
|
126
|
+
| `benchmark` | Cohort benchmarking: consent, submission, relative position |
|
|
127
|
+
| `login` / `logout` | Manage your API key credentials |
|
|
128
|
+
|
|
129
|
+
Every command takes `--help`.
|
|
130
|
+
|
|
131
|
+
## Fix, then prove the fix
|
|
132
|
+
|
|
133
|
+
A scanner that only emits findings leaves you with a PDF and a backlog. These
|
|
134
|
+
two commands close the loop, and they are why a report can say "fixed" and mean
|
|
135
|
+
it.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# 1. Scan, keeping the machine-readable report
|
|
139
|
+
shield-llm scan --preset standard --write-json shield-report.json
|
|
140
|
+
|
|
141
|
+
# 2. See which recipes apply, and which anchors would unlock the rest
|
|
142
|
+
shield-llm fix --report shield-report.json --explain
|
|
143
|
+
|
|
144
|
+
# 3. Apply. Writes marker-delimited blocks into your own working tree.
|
|
145
|
+
shield-llm fix --report shield-report.json
|
|
146
|
+
|
|
147
|
+
# 4. After your deploy, replay the original exploits and close the claims
|
|
148
|
+
shield-llm verify-claims
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`fix` writes to your local checkout and nothing else. It does not push. You read
|
|
152
|
+
the diff and commit it like any other change. `--dry-run` prints the diff and
|
|
153
|
+
writes nothing; `--revert` removes every block the recipe set owns.
|
|
154
|
+
|
|
155
|
+
### What the recipes cover
|
|
156
|
+
|
|
157
|
+
Five recipes ship today, each bound to one finding type. Every other finding
|
|
158
|
+
falls back to the prose remediation in the report.
|
|
159
|
+
|
|
160
|
+
| Recipe | Closes | Needs anchor |
|
|
161
|
+
| ------------------------------- | ---------------------------- | --------------- |
|
|
162
|
+
| `system-prompt-nondisclosure@1` | `SYSTEM_PROMPT_LEAK` | `system_prompt` |
|
|
163
|
+
| `instruction-precedence@1` | `INSTRUCTION_OVERRIDE` | `system_prompt` |
|
|
164
|
+
| `user-content-delimiting@1` | `DELIMITER_INJECTION` | `system_prompt` |
|
|
165
|
+
| `output-html-escape@1` | `XSS_OUTPUT` | `output_render` |
|
|
166
|
+
| `output-secret-redaction@1` | `SENSITIVE_DATA_EXTRACTION` | `output_render` |
|
|
167
|
+
|
|
168
|
+
All five are flagged for human review. Nothing auto-merges.
|
|
169
|
+
|
|
170
|
+
### Telling `fix` where your code lives
|
|
171
|
+
|
|
172
|
+
`fix` needs a `codebase` block in `shield.config.json`. A scan never reads it.
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"codebase": {
|
|
177
|
+
"root": ".",
|
|
178
|
+
"language": "ts",
|
|
179
|
+
"anchors": {
|
|
180
|
+
"system_prompt": { "file": "src/prompt.ts", "export": "SYSTEM_PROMPT" },
|
|
181
|
+
"output_render": { "file": "src/render.ts", "export": "renderReply" }
|
|
182
|
+
},
|
|
183
|
+
"redeploy": {
|
|
184
|
+
"command": "pnpm build && pnpm deploy:staging",
|
|
185
|
+
"timeoutMs": 300000,
|
|
186
|
+
"healthTimeoutMs": 60000
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
An anchor you have not declared is a soft skip: the recipe does not run, and the
|
|
193
|
+
output names the exact config key to add. An anchor pointing at a file or export
|
|
194
|
+
that does not exist is a hard error, because a stale config fakes coverage.
|
|
195
|
+
|
|
196
|
+
### What "verified" actually means
|
|
197
|
+
|
|
198
|
+
`fix --verify` redeploys your target with `codebase.redeploy`, then replays each
|
|
199
|
+
finding's design attacks plus a **holdout** attack that the harness draws. The
|
|
200
|
+
recipe does not get to choose its own holdout, so it cannot be authored to pass.
|
|
201
|
+
A benign suite runs alongside, so a patch that closes the exploit by breaking
|
|
202
|
+
the assistant is caught rather than shipped.
|
|
203
|
+
|
|
204
|
+
`redeploy` is never defaulted, deliberately. A guessed start command would
|
|
205
|
+
either fail outright or, far worse, appear to succeed while the old unpatched
|
|
206
|
+
process still held the port, producing a PR labelled "verified" that was
|
|
207
|
+
verified against the bug.
|
|
208
|
+
|
|
209
|
+
Two honest edges:
|
|
210
|
+
|
|
211
|
+
- `--allow-unverified` opens a PR with nothing verifying the patch. The PR body
|
|
212
|
+
says so. Verification is something you opt into, not something the command
|
|
213
|
+
guarantees.
|
|
214
|
+
- `verify-claims` is the primary closure path, meant to run from your deploy job
|
|
215
|
+
right after deploying. A claim it cannot re-prove stays open.
|
|
115
216
|
|
|
116
217
|
## Presets
|
|
117
218
|
|
|
118
219
|
| Preset | Scope |
|
|
119
220
|
| ---------- | -------------------------------------------------------- |
|
|
120
|
-
| `dev` | quick smoke test
|
|
121
|
-
| `quick` | fast triage
|
|
122
|
-
| `owasp` | one test per OWASP LLM Top 10 category
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
221
|
+
| `dev` | quick smoke test |
|
|
222
|
+
| `quick` | fast triage |
|
|
223
|
+
| `owasp` | one test per OWASP LLM Top 10 category |
|
|
224
|
+
| `frontier` | modern post-2025 attack vectors, harness-free |
|
|
225
|
+
| `standard` | broad coverage (recommended depth) |
|
|
226
|
+
| `full` | full catalogue + multi-turn (crescendo / memory) attacks |
|
|
125
227
|
|
|
126
|
-
|
|
228
|
+
Run `shield-llm presets` to see what your instance serves.
|
|
127
229
|
|
|
128
230
|
## Key scan flags
|
|
129
231
|
|
|
130
232
|
```
|
|
131
|
-
--preset <name> dev | quick | owasp | standard | full
|
|
233
|
+
--preset <name> dev | quick | owasp | frontier | standard | full
|
|
132
234
|
--endpoint <url> target URL (overrides config)
|
|
133
235
|
--system-prompt <text> give the target's system prompt for context
|
|
134
236
|
--crescendo include multi-turn attacks
|
|
@@ -137,6 +239,7 @@ Available presets depend on your plan; the backend filters them.
|
|
|
137
239
|
--eu-ai-act print an EU AI Act compliance summary
|
|
138
240
|
-o, --output <format> json | markdown | sarif | pdf
|
|
139
241
|
--output-file <path> write the report to a file
|
|
242
|
+
--write-json <path> always write a parseable JSON copy (feeds `fix --report`)
|
|
140
243
|
--min-score <n> fail if score < n
|
|
141
244
|
--fail-on-critical fail if any CRITICAL finding
|
|
142
245
|
--ci JSON to stdout, no spinner (logs to stderr)
|
|
@@ -154,6 +257,13 @@ Exit codes: `0` passed · `1` threshold violation · `2` config/auth error ·
|
|
|
154
257
|
`3` runtime/network error. Upload the SARIF to GitHub's Security tab, or use
|
|
155
258
|
`--write-json` to emit a parseable copy alongside any other format.
|
|
156
259
|
|
|
260
|
+
Run `verify-claims` from the deploy job itself, so a claim is re-proved against
|
|
261
|
+
what actually went live:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
shield-llm verify-claims --ci
|
|
265
|
+
```
|
|
266
|
+
|
|
157
267
|
## License
|
|
158
268
|
|
|
159
269
|
MIT
|