shield-llm 0.6.6 → 0.6.9
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 +29 -2
- package/dist/{chunk-4QYDLRL6.js → chunk-TWBU67PH.js} +372 -4120
- package/dist/cli.js +308 -90
- 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
|
|
@@ -257,6 +278,12 @@ Exit codes: `0` passed · `1` threshold violation · `2` config/auth error ·
|
|
|
257
278
|
`3` runtime/network error. Upload the SARIF to GitHub's Security tab, or use
|
|
258
279
|
`--write-json` to emit a parseable copy alongside any other format.
|
|
259
280
|
|
|
281
|
+
A target that answers `401` mid-scan (typically an access token that expired:
|
|
282
|
+
a Google Cloud token lasts about an hour) stops the scan with exit `2`. Nothing
|
|
283
|
+
is uploaded, the dashboard row is marked failed with the reason, and the
|
|
284
|
+
checkpoint is kept: refresh the token and re-run the same command to resume
|
|
285
|
+
where it stopped.
|
|
286
|
+
|
|
260
287
|
Run `verify-claims` from the deploy job itself, so a claim is re-proved against
|
|
261
288
|
what actually went live:
|
|
262
289
|
|