shield-llm 0.12.0 → 0.12.1
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/dist/{chunk-HVLBRBJD.js → chunk-GUNQB5SM.js} +22 -7
- package/dist/cli.js +12 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1353,6 +1353,11 @@ function scoredApart(attacks) {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
return (attack) => isObfuscationVariant(attack) && bases.has(baseAttackId(idOf(attack)));
|
|
1355
1355
|
}
|
|
1356
|
+
function withoutScoredApartVariants(rows, toScorable) {
|
|
1357
|
+
const scorable = rows.map(toScorable);
|
|
1358
|
+
const apart = scoredApart(scorable);
|
|
1359
|
+
return rows.filter((_, i) => !apart(scorable[i]));
|
|
1360
|
+
}
|
|
1356
1361
|
function weightedImpact(attacks) {
|
|
1357
1362
|
let totalWeight = 0;
|
|
1358
1363
|
let observedPenalty = 0;
|
|
@@ -9158,7 +9163,7 @@ function evaluateBenign(input) {
|
|
|
9158
9163
|
}
|
|
9159
9164
|
|
|
9160
9165
|
// package.json
|
|
9161
|
-
var version = "0.12.
|
|
9166
|
+
var version = "0.12.1";
|
|
9162
9167
|
|
|
9163
9168
|
// src/config/schema.ts
|
|
9164
9169
|
import { z as z2 } from "zod";
|
|
@@ -12153,12 +12158,21 @@ import path from "path";
|
|
|
12153
12158
|
import { fileURLToPath } from "url";
|
|
12154
12159
|
|
|
12155
12160
|
// src/reporters/build-report-data.ts
|
|
12161
|
+
var isReportFinding = (a) => a.vulnerable && a.severity !== "LOW";
|
|
12162
|
+
function countedSplit(judged) {
|
|
12163
|
+
const counted = withoutScoredApartVariants(judged, (a) => a);
|
|
12164
|
+
return {
|
|
12165
|
+
counted,
|
|
12166
|
+
detected: counted.filter(isReportFinding),
|
|
12167
|
+
passed: counted.filter((a) => !isReportFinding(a))
|
|
12168
|
+
};
|
|
12169
|
+
}
|
|
12170
|
+
var testedCountOf = (attacks) => withoutScoredApartVariants(attacks, (a) => a).length;
|
|
12156
12171
|
function buildReportData(report) {
|
|
12157
12172
|
const allAttacks = report.attacks;
|
|
12158
12173
|
const judged = allAttacks.filter((a) => !a.error && !a.rateLimited);
|
|
12159
12174
|
const untested = buildUntested(allAttacks);
|
|
12160
|
-
const
|
|
12161
|
-
const passed = judged.filter((a) => !a.vulnerable || a.severity === "LOW");
|
|
12175
|
+
const { counted, detected, passed } = countedSplit(judged);
|
|
12162
12176
|
const criticalCount = detected.filter(
|
|
12163
12177
|
(a) => a.severity === "CRITICAL"
|
|
12164
12178
|
).length;
|
|
@@ -12168,7 +12182,7 @@ function buildReportData(report) {
|
|
|
12168
12182
|
const comboCount = detected.filter((a) => a.severity === "COMBO").length;
|
|
12169
12183
|
const highCount = detected.filter((a) => a.severity === "HIGH").length;
|
|
12170
12184
|
const mediumCount = detected.filter((a) => a.severity === "MEDIUM").length;
|
|
12171
|
-
const vulnerabilities =
|
|
12185
|
+
const vulnerabilities = judged.filter(isReportFinding).sort((a, b) => severityOrder(a.severity) - severityOrder(b.severity)).map((a) => buildVulnDetail(a));
|
|
12172
12186
|
const passedTests = passed.map((a) => {
|
|
12173
12187
|
const owaspId = owaspLabel(a.id).id;
|
|
12174
12188
|
return {
|
|
@@ -12180,7 +12194,7 @@ function buildReportData(report) {
|
|
|
12180
12194
|
)
|
|
12181
12195
|
};
|
|
12182
12196
|
}).sort((a, b) => severityOrder(a.severity) - severityOrder(b.severity));
|
|
12183
|
-
const owaspMap = buildOwaspMap(
|
|
12197
|
+
const owaspMap = buildOwaspMap(counted, detected);
|
|
12184
12198
|
const owaspBreakdown = buildOwaspBreakdown(owaspMap);
|
|
12185
12199
|
const owaspCoverage = buildOwaspCoverage(owaspMap);
|
|
12186
12200
|
const grade = report.grade;
|
|
@@ -12212,7 +12226,7 @@ function buildReportData(report) {
|
|
|
12212
12226
|
highCount,
|
|
12213
12227
|
mediumCount,
|
|
12214
12228
|
passedCount: passed.length,
|
|
12215
|
-
totalTests: allAttacks
|
|
12229
|
+
totalTests: testedCountOf(allAttacks),
|
|
12216
12230
|
untested,
|
|
12217
12231
|
variantsLine: variantsLineFor(allAttacks),
|
|
12218
12232
|
executiveSummary: buildExecutiveSummary(
|
|
@@ -12222,7 +12236,7 @@ function buildReportData(report) {
|
|
|
12222
12236
|
comboCount,
|
|
12223
12237
|
highCount,
|
|
12224
12238
|
mediumCount,
|
|
12225
|
-
allAttacks
|
|
12239
|
+
testedCountOf(allAttacks),
|
|
12226
12240
|
report.target,
|
|
12227
12241
|
untested,
|
|
12228
12242
|
CURRENT_OWASP_TAXONOMY
|
|
@@ -14476,6 +14490,7 @@ export {
|
|
|
14476
14490
|
getMutator,
|
|
14477
14491
|
expandWithMutators,
|
|
14478
14492
|
baseAttackId,
|
|
14493
|
+
withoutScoredApartVariants,
|
|
14479
14494
|
summarizeObfuscationVariants,
|
|
14480
14495
|
replaceLoneSurrogates,
|
|
14481
14496
|
JUDGE_OUTAGE_REASON_PREFIX,
|
package/dist/cli.js
CHANGED
|
@@ -75,8 +75,9 @@ import {
|
|
|
75
75
|
sha256Hex,
|
|
76
76
|
summarizeAttackErrors,
|
|
77
77
|
summarizeObfuscationVariants,
|
|
78
|
-
version
|
|
79
|
-
|
|
78
|
+
version,
|
|
79
|
+
withoutScoredApartVariants
|
|
80
|
+
} from "./chunk-GUNQB5SM.js";
|
|
80
81
|
|
|
81
82
|
// src/load-env.ts
|
|
82
83
|
try {
|
|
@@ -1807,6 +1808,14 @@ function printAttackComplete(event) {
|
|
|
1807
1808
|
spinner.start();
|
|
1808
1809
|
}
|
|
1809
1810
|
}
|
|
1811
|
+
function countsLine(report) {
|
|
1812
|
+
const counted = withoutScoredApartVariants(report.attacks, (a) => a);
|
|
1813
|
+
const vulnerable = counted.filter((a) => a.vulnerable);
|
|
1814
|
+
const secure = counted.filter((a) => !a.vulnerable && !a.error);
|
|
1815
|
+
const errors = counted.filter((a) => a.error && !a.judgeUnavailable);
|
|
1816
|
+
const notJudged = counted.filter((a) => a.judgeUnavailable);
|
|
1817
|
+
return ` ${c.red(`${vulnerable.length} vulnerable`)} \xB7 ${c.green(`${secure.length} secure`)} \xB7 ${c.yellow(`${errors.length} errors`)}` + (notJudged.length > 0 ? ` \xB7 ${c.yellow(`${notJudged.length} not judged`)}` : "");
|
|
1818
|
+
}
|
|
1810
1819
|
function printSummary(report, thresholds, gate) {
|
|
1811
1820
|
console.log("");
|
|
1812
1821
|
console.log(c.bold("\u2550\u2550\u2550 Shield LLM Scan Results \u2550\u2550\u2550"));
|
|
@@ -1818,11 +1827,7 @@ function printSummary(report, thresholds, gate) {
|
|
|
1818
1827
|
console.log("");
|
|
1819
1828
|
const vulnerable = report.attacks.filter((a) => a.vulnerable);
|
|
1820
1829
|
const secure = report.attacks.filter((a) => !a.vulnerable && !a.error);
|
|
1821
|
-
|
|
1822
|
-
const notJudged = report.attacks.filter((a) => a.judgeUnavailable);
|
|
1823
|
-
console.log(
|
|
1824
|
-
` ${c.red(`${vulnerable.length} vulnerable`)} \xB7 ${c.green(`${secure.length} secure`)} \xB7 ${c.yellow(`${errors.length} errors`)}` + (notJudged.length > 0 ? ` \xB7 ${c.yellow(`${notJudged.length} not judged`)}` : "")
|
|
1825
|
-
);
|
|
1830
|
+
console.log(countsLine(report));
|
|
1826
1831
|
const evaluated = vulnerable.length + secure.length;
|
|
1827
1832
|
const total = report.attacks.length;
|
|
1828
1833
|
if (evaluated < total) {
|
package/dist/index.js
CHANGED