shield-llm 0.6.8 → 0.7.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 +55 -2
- package/dist/{chunk-HQGV3UIF.js → chunk-WGJYDA2Q.js} +422 -83
- package/dist/cli.js +221 -85
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -79,8 +79,29 @@ shield-llm scan --preset owasp
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
- `{{prompt}}` is replaced with each attack. `{{
|
|
83
|
-
|
|
82
|
+
- `{{prompt}}` is replaced with each attack. `{{sessionId}}` (URL, header or
|
|
83
|
+
body) gives each attack its own conversation on a stateful chatbot.
|
|
84
|
+
- **Multi-turn attacks need the target to see the conversation.** For a
|
|
85
|
+
stateless chat API, put `{{history}}` as an item of the message array, before
|
|
86
|
+
the current turn — it expands to the turns so far:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
"body": { "messages": ["{{history}}", { "role": "user", "content": "{{prompt}}" }] }
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Gemini / Vertex AI (`generateContent`) uses its own shape — add
|
|
93
|
+
`"historyFormat": "gemini"` to `request`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"request": {
|
|
97
|
+
"body": { "contents": ["{{history}}", { "role": "user", "parts": [{ "text": "{{prompt}}" }] }] },
|
|
98
|
+
"historyFormat": "gemini"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
With no `{{history}}`, no `{{sessionId}}` and no `"statefulConversation": true`,
|
|
103
|
+
multi-turn attacks are reported as **not run** (each turn would arrive as a
|
|
104
|
+
new conversation, so they could only ever "resist").
|
|
84
105
|
- `response.field` is a dot-path into the JSON response (e.g.
|
|
85
106
|
`choices[0].message.content`). SSE streams are auto-detected.
|
|
86
107
|
- Auth: `bearer`, `api-key`, or `oauth2` (use `$ENV_VAR` to read secrets from
|
|
@@ -214,6 +235,21 @@ Two honest edges:
|
|
|
214
235
|
- `verify-claims` is the primary closure path, meant to run from your deploy job
|
|
215
236
|
right after deploying. A claim it cannot re-prove stays open.
|
|
216
237
|
|
|
238
|
+
### The record an auditor reads (DORA Art. 24(5))
|
|
239
|
+
|
|
240
|
+
DORA Art. 24(5) asks financial entities for internal validation methods "to
|
|
241
|
+
ascertain that all identified weaknesses, deficiencies or gaps are fully
|
|
242
|
+
addressed". Each `verify-claims` run appends what it observed to the claim:
|
|
243
|
+
every design and holdout attack with its result (closed, still vulnerable, not
|
|
244
|
+
executed), the reason the claim moved, the benign gate and the judge's health.
|
|
245
|
+
A refutation before the deploy and the confirmation after it both stay on file.
|
|
246
|
+
|
|
247
|
+
`scan --evidence-bundle <path>` files that record next to the scan, in the
|
|
248
|
+
checksummed bundle (`shield-evidence/3`): a `remediationValidation` section
|
|
249
|
+
quoting Art. 24(5) word for word, with this target's claims from the local
|
|
250
|
+
claim store. The obligation binds your entity; the bundle is evidence your own
|
|
251
|
+
validation can rely on, not a statement that you comply.
|
|
252
|
+
|
|
217
253
|
## Presets
|
|
218
254
|
|
|
219
255
|
| Preset | Scope |
|
|
@@ -237,6 +273,7 @@ Run `shield-llm presets` to see what your instance serves.
|
|
|
237
273
|
--load-custom-tests also run your dashboard's custom tests
|
|
238
274
|
--custom-only run ONLY your custom tests (no preset attacks)
|
|
239
275
|
--eu-ai-act print an EU AI Act compliance summary
|
|
276
|
+
--evidence-bundle <path> write the checksummed evidence bundle (EU AI Act + DORA Art. 24(5) fixes)
|
|
240
277
|
-o, --output <format> json | markdown | sarif | pdf
|
|
241
278
|
--output-file <path> write the report to a file
|
|
242
279
|
--write-json <path> always write a parseable JSON copy (feeds `fix --report`)
|
|
@@ -257,6 +294,22 @@ Exit codes: `0` passed · `1` threshold violation · `2` config/auth error ·
|
|
|
257
294
|
`3` runtime/network error. Upload the SARIF to GitHub's Security tab, or use
|
|
258
295
|
`--write-json` to emit a parseable copy alongside any other format.
|
|
259
296
|
|
|
297
|
+
A target that answers `401` mid-scan (typically an access token that expired:
|
|
298
|
+
a Google Cloud token lasts about an hour) stops the scan with exit `2`. Nothing
|
|
299
|
+
is uploaded, the dashboard row is marked failed with the reason, and the
|
|
300
|
+
checkpoint is kept: refresh the token and re-run the same command to resume
|
|
301
|
+
where it stopped.
|
|
302
|
+
|
|
303
|
+
The same applies to the other early stops, with exit `3`: a target that keeps
|
|
304
|
+
answering `429` past the retry budget, and the consecutive-failure breaker (the
|
|
305
|
+
target failing or unreachable several requests in a row). A scan that stopped
|
|
306
|
+
early is never reported as finished: re-run the same command later to resume.
|
|
307
|
+
|
|
308
|
+
A reply withheld by the provider's content filter (Gemini / Vertex AI
|
|
309
|
+
`promptFeedback.blockReason` or a filter `finishReason`, OpenAI-compatible
|
|
310
|
+
`finish_reason: "content_filter"`) is judged as a refusal, not counted as a
|
|
311
|
+
failed request.
|
|
312
|
+
|
|
260
313
|
Run `verify-claims` from the deploy job itself, so a claim is re-proved against
|
|
261
314
|
what actually went live:
|
|
262
315
|
|