shield-llm 0.2.2 → 0.3.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 +7 -4
- package/dist/{chunk-LH6W4P2C.js → chunk-LR2LXQEB.js} +5 -15
- package/dist/cli.js +6 -22
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,8 +76,9 @@ shield-llm scan --preset owasp
|
|
|
76
76
|
|---------|-------------|
|
|
77
77
|
| `scan` | Run a security scan against a target chatbot |
|
|
78
78
|
| `init` | Interactive wizard → generates `shield.config.json` |
|
|
79
|
+
| `test-connection` | Send one benign message to check your config works (no attacks) |
|
|
79
80
|
| `login` / `logout` | Manage your API key credentials |
|
|
80
|
-
| `attacks` |
|
|
81
|
+
| `attacks` | Show the attack catalogue summary for your plan (counts, from your backend) |
|
|
81
82
|
| `presets` | List available scan presets |
|
|
82
83
|
| `tests` | List custom tests (local config and/or `--remote`) |
|
|
83
84
|
| `validate` | Validate a `shield.config.json` without scanning |
|
|
@@ -87,9 +88,9 @@ shield-llm scan --preset owasp
|
|
|
87
88
|
|
|
88
89
|
| Preset | Scope |
|
|
89
90
|
|--------|-------|
|
|
90
|
-
| `dev` |
|
|
91
|
-
| `quick` |
|
|
92
|
-
| `owasp` |
|
|
91
|
+
| `dev` | quick smoke test |
|
|
92
|
+
| `quick` | fast triage |
|
|
93
|
+
| `owasp` | one test per OWASP LLM Top 10 category |
|
|
93
94
|
| `standard` | broad coverage |
|
|
94
95
|
| `full` | full catalogue + multi-turn (crescendo / memory) attacks |
|
|
95
96
|
|
|
@@ -103,12 +104,14 @@ Available presets depend on your plan; the backend filters them.
|
|
|
103
104
|
--system-prompt <text> give the target's system prompt for context
|
|
104
105
|
--crescendo include multi-turn attacks
|
|
105
106
|
--load-custom-tests also run your dashboard's custom tests
|
|
107
|
+
--custom-only run ONLY your custom tests (no preset attacks)
|
|
106
108
|
--eu-ai-act print an EU AI Act compliance summary
|
|
107
109
|
-o, --output <format> json | markdown | sarif | pdf
|
|
108
110
|
--output-file <path> write the report to a file
|
|
109
111
|
--min-score <n> fail if score < n
|
|
110
112
|
--fail-on-critical fail if any CRITICAL finding
|
|
111
113
|
--ci JSON to stdout, no spinner (logs to stderr)
|
|
114
|
+
--include-full-payloads keep full chatbot responses in the JSON (default: truncated)
|
|
112
115
|
```
|
|
113
116
|
|
|
114
117
|
## CI/CD
|
|
@@ -23414,11 +23414,9 @@ var OutputSchema = z29.object({
|
|
|
23414
23414
|
|
|
23415
23415
|
// src/config/schema.ts
|
|
23416
23416
|
var ConfigSchema = z30.object({
|
|
23417
|
-
/**
|
|
23418
|
-
|
|
23419
|
-
/**
|
|
23420
|
-
endpoint: EndpointConfigSchema.optional(),
|
|
23421
|
-
/** Judge LLM provider (always LLM-based) */
|
|
23417
|
+
/** HTTP endpoint mode (URL + auth + template) — the only target mode */
|
|
23418
|
+
endpoint: EndpointConfigSchema,
|
|
23419
|
+
/** Judge LLM provider (judging is server-side; kept for display/compat) */
|
|
23422
23420
|
judge: ProviderConfigSchema.optional(),
|
|
23423
23421
|
systemPrompt: z30.string().optional(),
|
|
23424
23422
|
preset: z30.enum(["dev", "quick", "owasp", "standard", "full"]).optional(),
|
|
@@ -23430,8 +23428,6 @@ var ConfigSchema = z30.object({
|
|
|
23430
23428
|
maxConsecutiveFailures: z30.number().int().min(1).optional(),
|
|
23431
23429
|
thresholds: ThresholdSchema.optional(),
|
|
23432
23430
|
output: OutputSchema.optional()
|
|
23433
|
-
}).refine((data) => data.target || data.endpoint, {
|
|
23434
|
-
message: "Either 'target' (LLM provider) or 'endpoint' (HTTP URL) must be specified"
|
|
23435
23431
|
});
|
|
23436
23432
|
|
|
23437
23433
|
// src/config/loader.ts
|
|
@@ -23466,15 +23462,9 @@ ${issues}`);
|
|
|
23466
23462
|
return result.data;
|
|
23467
23463
|
}
|
|
23468
23464
|
function buildTargetConfig(config) {
|
|
23469
|
-
if (config.endpoint) {
|
|
23470
|
-
return {
|
|
23471
|
-
mode: "endpoint",
|
|
23472
|
-
...config.endpoint
|
|
23473
|
-
};
|
|
23474
|
-
}
|
|
23475
23465
|
return {
|
|
23476
|
-
mode: "
|
|
23477
|
-
...config.
|
|
23466
|
+
mode: "endpoint",
|
|
23467
|
+
...config.endpoint
|
|
23478
23468
|
};
|
|
23479
23469
|
}
|
|
23480
23470
|
function loadSystemPrompt(config) {
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
generatePdf,
|
|
18
18
|
loadConfig,
|
|
19
19
|
loadSystemPrompt
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LR2LXQEB.js";
|
|
21
21
|
import "./chunk-7D5WVZW5.js";
|
|
22
22
|
|
|
23
23
|
// src/cli.ts
|
|
@@ -1058,11 +1058,6 @@ async function scanCommand(opts) {
|
|
|
1058
1058
|
field: opts.responseField ?? "response"
|
|
1059
1059
|
}
|
|
1060
1060
|
};
|
|
1061
|
-
} else if (opts.provider || opts.model) {
|
|
1062
|
-
cliOverrides.target = {
|
|
1063
|
-
provider: opts.provider,
|
|
1064
|
-
model: opts.model
|
|
1065
|
-
};
|
|
1066
1061
|
}
|
|
1067
1062
|
if (opts.preset) cliOverrides.preset = opts.preset;
|
|
1068
1063
|
if (opts.systemPrompt) cliOverrides.systemPrompt = opts.systemPrompt;
|
|
@@ -1377,20 +1372,9 @@ function validateCommand(opts) {
|
|
|
1377
1372
|
try {
|
|
1378
1373
|
const config = loadConfig({ configPath: opts.config });
|
|
1379
1374
|
console.log("Configuration is valid.");
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
console.log(` Auth: ${config.endpoint.auth?.type ?? "none"}`);
|
|
1384
|
-
console.log(` Response field: ${config.endpoint.response.field}`);
|
|
1385
|
-
} else {
|
|
1386
|
-
console.log(` Mode: LLM Provider`);
|
|
1387
|
-
console.log(
|
|
1388
|
-
` Target: ${config.target.provider}/${config.target.model ?? "default"}`
|
|
1389
|
-
);
|
|
1390
|
-
}
|
|
1391
|
-
console.log(
|
|
1392
|
-
` Judge: ${config.judge?.provider ?? "mistral"}/${config.judge?.model ?? "mistral-small-latest"}`
|
|
1393
|
-
);
|
|
1375
|
+
console.log(` Target: ${config.endpoint.url}`);
|
|
1376
|
+
console.log(` Auth: ${config.endpoint.auth?.type ?? "none"}`);
|
|
1377
|
+
console.log(` Response field: ${config.endpoint.response.field}`);
|
|
1394
1378
|
console.log(` Preset: ${config.preset ?? "standard"}`);
|
|
1395
1379
|
if (config.customTests?.length) {
|
|
1396
1380
|
console.log(` Custom tests: ${config.customTests.length}`);
|
|
@@ -1429,8 +1413,8 @@ process.on("uncaughtException", (err) => {
|
|
|
1429
1413
|
});
|
|
1430
1414
|
var program = new Command();
|
|
1431
1415
|
program.exitOverride();
|
|
1432
|
-
program.name("shield-llm").description("AI chatbot security scanner \u2014 automated red teaming for LLMs").version("0.
|
|
1433
|
-
program.command("scan").description("Run a security scan against a target chatbot").option("-c, --config <path>", "Path to shield.config.json").option("-
|
|
1416
|
+
program.name("shield-llm").description("AI chatbot security scanner \u2014 automated red teaming for LLMs").version("0.3.0");
|
|
1417
|
+
program.command("scan").description("Run a security scan against a target chatbot").option("-c, --config <path>", "Path to shield.config.json").option("-e, --endpoint <url>", "Target chatbot HTTP endpoint URL").option("--auth <type>", "Auth type: bearer, api-key, oauth2").option("--token <value>", "Bearer token or API key value").option("--auth-header <name>", "Custom auth header name (for api-key auth)").option(
|
|
1434
1418
|
"--response-field <path>",
|
|
1435
1419
|
"Dot-notation path to response text in JSON (default: response)"
|
|
1436
1420
|
).option(
|
package/dist/index.js
CHANGED