shield-llm 0.7.0 → 0.7.2
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 +3 -6
- package/dist/{chunk-WGJYDA2Q.js → chunk-OLRBOH6L.js} +33 -20
- package/dist/cli.js +15 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,12 +25,9 @@ Which OWASP LLM Top 10 edition your report is labelled with follows the attack
|
|
|
25
25
|
pack your instance serves, not the CLI version. An archived report keeps the
|
|
26
26
|
category names that were current on the day it ran.
|
|
27
27
|
|
|
28
|
-
> A backend connection is required
|
|
29
|
-
>
|
|
30
|
-
>
|
|
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.
|
|
28
|
+
> A backend connection is required: your self-hosted Shield instance, named
|
|
29
|
+
> with `--api-url` (or the `SHIELD_API_URL` env var). There is no default
|
|
30
|
+
> backend; without one the CLI stops and says so.
|
|
34
31
|
|
|
35
32
|
## Install
|
|
36
33
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "module"; import { fileURLToPath as __cjs_fileURLToPath } from "url"; import { dirname as __cjs_dirname } from "path"; const __filename = __cjs_fileURLToPath(import.meta.url); const __dirname = __cjs_dirname(__filename); const require = __cjs_createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// package.json
|
|
4
|
-
var version = "0.7.
|
|
4
|
+
var version = "0.7.2";
|
|
5
5
|
|
|
6
6
|
// src/config/schema.ts
|
|
7
7
|
import { z as z2 } from "zod";
|
|
@@ -999,18 +999,26 @@ function isTimeout(err) {
|
|
|
999
999
|
return typeof err === "object" && err !== null && err.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
|
|
1000
1000
|
}
|
|
1001
1001
|
function guardedRun(fn, budget) {
|
|
1002
|
-
|
|
1002
|
+
return guardedRunWith(getExec(), fn, budget);
|
|
1003
|
+
}
|
|
1004
|
+
function guardedRunWith(run, fn, budget) {
|
|
1003
1005
|
if (!run || watched) return { completed: true, value: fn() };
|
|
1004
1006
|
const remaining = Math.floor(budget.deadline - performance.now());
|
|
1005
1007
|
if (remaining < 1) {
|
|
1006
1008
|
budget.timedOut = true;
|
|
1007
1009
|
return { completed: false };
|
|
1008
1010
|
}
|
|
1011
|
+
const finished = { done: false };
|
|
1009
1012
|
watched = true;
|
|
1010
1013
|
try {
|
|
1011
|
-
|
|
1014
|
+
run(() => {
|
|
1015
|
+
finished.value = fn();
|
|
1016
|
+
finished.done = true;
|
|
1017
|
+
}, remaining);
|
|
1018
|
+
return { completed: true, value: finished.value };
|
|
1012
1019
|
} catch (err) {
|
|
1013
1020
|
if (!isTimeout(err)) throw err;
|
|
1021
|
+
if (finished.done) return { completed: true, value: finished.value };
|
|
1014
1022
|
budget.timedOut = true;
|
|
1015
1023
|
return { completed: false };
|
|
1016
1024
|
} finally {
|
|
@@ -1026,9 +1034,8 @@ function boundRegexInput(response) {
|
|
|
1026
1034
|
return `${response.slice(0, half)}
|
|
1027
1035
|
${response.slice(-half)}`;
|
|
1028
1036
|
}
|
|
1029
|
-
function analyzeResponse(payload, rawResponse) {
|
|
1037
|
+
function analyzeResponse(payload, rawResponse, budget = regexBudget()) {
|
|
1030
1038
|
const response = boundRegexInput(rawResponse);
|
|
1031
|
-
const budget = regexBudget();
|
|
1032
1039
|
let matchedPattern;
|
|
1033
1040
|
guardedRun(() => {
|
|
1034
1041
|
for (const pattern of payload.detectPatterns) {
|
|
@@ -10399,7 +10406,10 @@ var Scanner = class {
|
|
|
10399
10406
|
// detect a degraded scan without parsing reasoning text.
|
|
10400
10407
|
...evalResult.llmResult.judgeError && {
|
|
10401
10408
|
judgeError: evalResult.llmResult.judgeError
|
|
10402
|
-
}
|
|
10409
|
+
},
|
|
10410
|
+
// The judge that produced this verdict: the scan's judgeVersion is
|
|
10411
|
+
// composed from these, and a checkpoint keeps it for a resumed scan.
|
|
10412
|
+
...evalResult.judgeId && { judgeId: evalResult.judgeId }
|
|
10403
10413
|
};
|
|
10404
10414
|
}
|
|
10405
10415
|
createSkippedResult(attack, reason, isRateLimited) {
|
|
@@ -11342,7 +11352,10 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
11342
11352
|
Page size: A4 (210mm \xD7 297mm)
|
|
11343
11353
|
============================================ */
|
|
11344
11354
|
|
|
11345
|
-
@import
|
|
11355
|
+
/* No web-font @import: rendering the report must make no network call (it
|
|
11356
|
+
used to fetch Google Fonts). DM Sans / JetBrains Mono are used when
|
|
11357
|
+
installed, otherwise the system stacks below. The CLI ships no font files
|
|
11358
|
+
to keep the npm package small; the web app embeds them. */
|
|
11346
11359
|
|
|
11347
11360
|
@page {
|
|
11348
11361
|
margin: 0;
|
|
@@ -11425,7 +11438,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
11425
11438
|
}
|
|
11426
11439
|
|
|
11427
11440
|
body {
|
|
11428
|
-
font-family: 'DM Sans', sans-serif;
|
|
11441
|
+
font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
|
|
11429
11442
|
color: var(--text-primary);
|
|
11430
11443
|
background: white;
|
|
11431
11444
|
line-height: 1.5;
|
|
@@ -11685,7 +11698,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
11685
11698
|
}
|
|
11686
11699
|
|
|
11687
11700
|
.meta-value.mono {
|
|
11688
|
-
font-family: 'JetBrains Mono', monospace;
|
|
11701
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
11689
11702
|
font-size: 13px;
|
|
11690
11703
|
}
|
|
11691
11704
|
|
|
@@ -11725,14 +11738,14 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
11725
11738
|
}
|
|
11726
11739
|
|
|
11727
11740
|
.owasp-id {
|
|
11728
|
-
font-family: 'JetBrains Mono', monospace;
|
|
11741
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
11729
11742
|
font-size: 11px;
|
|
11730
11743
|
font-weight: 500;
|
|
11731
11744
|
color: var(--brand-accent);
|
|
11732
11745
|
}
|
|
11733
11746
|
|
|
11734
11747
|
.owasp-score {
|
|
11735
|
-
font-family: 'JetBrains Mono', monospace;
|
|
11748
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
11736
11749
|
font-size: 11px;
|
|
11737
11750
|
font-weight: 600;
|
|
11738
11751
|
}
|
|
@@ -12026,7 +12039,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12026
12039
|
display: inline-block;
|
|
12027
12040
|
padding: 2px 8px;
|
|
12028
12041
|
border-radius: 3px;
|
|
12029
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12042
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12030
12043
|
font-size: 10px;
|
|
12031
12044
|
font-weight: 500;
|
|
12032
12045
|
color: var(--brand-accent);
|
|
@@ -12160,7 +12173,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12160
12173
|
background: var(--brand-dark);
|
|
12161
12174
|
border-radius: 6px;
|
|
12162
12175
|
padding: 12px 16px;
|
|
12163
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12176
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12164
12177
|
font-size: 11px;
|
|
12165
12178
|
line-height: 1.5;
|
|
12166
12179
|
color: #E2E8F0;
|
|
@@ -12209,7 +12222,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12209
12222
|
}
|
|
12210
12223
|
|
|
12211
12224
|
.truncation-notice .char-count {
|
|
12212
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12225
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12213
12226
|
font-size: 10px;
|
|
12214
12227
|
color: #475569;
|
|
12215
12228
|
}
|
|
@@ -12230,7 +12243,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12230
12243
|
background: var(--brand-dark);
|
|
12231
12244
|
border-radius: 4px;
|
|
12232
12245
|
padding: 8px 14px;
|
|
12233
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12246
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12234
12247
|
font-size: 11px;
|
|
12235
12248
|
line-height: 1.4;
|
|
12236
12249
|
color: #E2E8F0;
|
|
@@ -12317,7 +12330,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12317
12330
|
}
|
|
12318
12331
|
|
|
12319
12332
|
.confidence-text {
|
|
12320
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12333
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12321
12334
|
font-size: 11px;
|
|
12322
12335
|
color: var(--text-secondary);
|
|
12323
12336
|
}
|
|
@@ -12421,7 +12434,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12421
12434
|
.owasp-ref {
|
|
12422
12435
|
font-size: 10px;
|
|
12423
12436
|
color: var(--text-muted);
|
|
12424
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12437
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12425
12438
|
margin-left: 4px;
|
|
12426
12439
|
}
|
|
12427
12440
|
|
|
@@ -12502,7 +12515,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12502
12515
|
}
|
|
12503
12516
|
|
|
12504
12517
|
.eval-method {
|
|
12505
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12518
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12506
12519
|
font-size: 10px;
|
|
12507
12520
|
color: var(--text-muted);
|
|
12508
12521
|
background: var(--surface-light);
|
|
@@ -12547,7 +12560,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12547
12560
|
}
|
|
12548
12561
|
|
|
12549
12562
|
.owasp-category-id {
|
|
12550
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12563
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12551
12564
|
font-size: 12px;
|
|
12552
12565
|
font-weight: 600;
|
|
12553
12566
|
color: var(--brand-accent);
|
|
@@ -12582,7 +12595,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
|
|
|
12582
12595
|
.score-mini-bar-fill.none { background: var(--surface-border); }
|
|
12583
12596
|
|
|
12584
12597
|
.score-mini-text {
|
|
12585
|
-
font-family: 'JetBrains Mono', monospace;
|
|
12598
|
+
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
12586
12599
|
font-size: 12px;
|
|
12587
12600
|
font-weight: 600;
|
|
12588
12601
|
min-width: 40px;
|
package/dist/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
sha256Hex,
|
|
68
68
|
summarizeAttackErrors,
|
|
69
69
|
version
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-OLRBOH6L.js";
|
|
71
71
|
|
|
72
72
|
// src/load-env.ts
|
|
73
73
|
try {
|
|
@@ -902,7 +902,7 @@ ${issues}`);
|
|
|
902
902
|
`);
|
|
903
903
|
console.log(" Next steps:");
|
|
904
904
|
console.log(
|
|
905
|
-
" shield-llm login Authenticate
|
|
905
|
+
" shield-llm login Authenticate to your Shield instance"
|
|
906
906
|
);
|
|
907
907
|
console.log(" shield-llm validate Verify your configuration");
|
|
908
908
|
console.log(" shield-llm scan Run a scan with your preset");
|
|
@@ -1360,7 +1360,9 @@ var BackendEvaluator = class {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
throw new Error(userMessage);
|
|
1362
1362
|
}
|
|
1363
|
-
|
|
1363
|
+
const result = await response.json();
|
|
1364
|
+
const judgeId = result.meta?.judgeId;
|
|
1365
|
+
return typeof judgeId === "string" ? { ...result, judgeId } : result;
|
|
1364
1366
|
}
|
|
1365
1367
|
}
|
|
1366
1368
|
/** Backoff for one retry: a 429 Retry-After (seconds) when present, else
|
|
@@ -2552,8 +2554,8 @@ function incompleteScan(report, judged, total) {
|
|
|
2552
2554
|
}
|
|
2553
2555
|
|
|
2554
2556
|
// src/commands/scan.ts
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
+
function buildUploadVulnerabilities(attacks) {
|
|
2558
|
+
return scoredAttacks(attacks).map((a) => ({
|
|
2557
2559
|
// attackId lets the backend validate against its known catalogue + the
|
|
2558
2560
|
// user's custom tests, rejecting fabricated vulnerability rows.
|
|
2559
2561
|
attackId: a.id,
|
|
@@ -2571,10 +2573,16 @@ async function uploadReportToBackend(report, credentials, scanId, attackPackVers
|
|
|
2571
2573
|
}) : void 0,
|
|
2572
2574
|
status: a.vulnerable ? "DETECTED" : "PASSED",
|
|
2573
2575
|
evaluationMethod: a.llmEvaluation?.evaluationMethod,
|
|
2576
|
+
// The judge that produced this verdict (backend meta.judgeId): the server
|
|
2577
|
+
// composes the scan's judgeVersion from these instead of guessing.
|
|
2578
|
+
judgeId: a.llmEvaluation?.judgeId,
|
|
2574
2579
|
confidence: a.llmEvaluation?.confidence,
|
|
2575
2580
|
reasoning: a.llmEvaluation?.reasoning,
|
|
2576
2581
|
captureStatus: a.captureStatus ?? "captured"
|
|
2577
2582
|
}));
|
|
2583
|
+
}
|
|
2584
|
+
async function uploadReportToBackend(report, credentials, scanId, attackPackVersion) {
|
|
2585
|
+
const vulnerabilities = buildUploadVulnerabilities(report.attacks);
|
|
2578
2586
|
const testsRun = scoredAttacks(report.attacks).length;
|
|
2579
2587
|
const attackErrorSummary = summarizeAttackErrors(report.attacks);
|
|
2580
2588
|
const payload = {
|
|
@@ -2734,9 +2742,8 @@ async function scanCommand(opts) {
|
|
|
2734
2742
|
const credentials = stored ? { ...stored, apiUrl: resolveApiUrl(stored.apiUrl, opts.apiUrl) } : null;
|
|
2735
2743
|
if (!credentials) {
|
|
2736
2744
|
console.error(
|
|
2737
|
-
`Not logged in.
|
|
2738
|
-
|
|
2739
|
-
License: shield-llm login --key <license-key> --api-url https://your-instance
|
|
2745
|
+
`Not logged in. Point the CLI at your Shield instance:
|
|
2746
|
+
shield-llm login --key <api-key> --api-url <your-instance-url>
|
|
2740
2747
|
`
|
|
2741
2748
|
);
|
|
2742
2749
|
setExitCode(2);
|
package/dist/index.js
CHANGED