xploitscan-shared-rules 2.4.28 → 2.4.29
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/index.cjs +82 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +82 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -169,7 +169,7 @@ interface CustomRule {
|
|
|
169
169
|
* before a scan can be saved without enough provenance to explain a changed
|
|
170
170
|
* grade.
|
|
171
171
|
*/
|
|
172
|
-
declare const SCANNER_VERSION = "2.4.
|
|
172
|
+
declare const SCANNER_VERSION = "2.4.29";
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -305,7 +305,7 @@ declare const MODEL_TRIAGE = "claude-haiku-5-5";
|
|
|
305
305
|
* update the IDs above if the line-up moved (especially MODEL_TRIAGE to the
|
|
306
306
|
* current Haiku), and set today's date here.
|
|
307
307
|
*/
|
|
308
|
-
declare const MODEL_POLICY_REVIEWED = "2026-
|
|
308
|
+
declare const MODEL_POLICY_REVIEWED = "2026-11-12";
|
|
309
309
|
/**
|
|
310
310
|
* How long a review stays fresh before CI asks for another one.
|
|
311
311
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ interface CustomRule {
|
|
|
169
169
|
* before a scan can be saved without enough provenance to explain a changed
|
|
170
170
|
* grade.
|
|
171
171
|
*/
|
|
172
|
-
declare const SCANNER_VERSION = "2.4.
|
|
172
|
+
declare const SCANNER_VERSION = "2.4.29";
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -305,7 +305,7 @@ declare const MODEL_TRIAGE = "claude-haiku-5-5";
|
|
|
305
305
|
* update the IDs above if the line-up moved (especially MODEL_TRIAGE to the
|
|
306
306
|
* current Haiku), and set today's date here.
|
|
307
307
|
*/
|
|
308
|
-
declare const MODEL_POLICY_REVIEWED = "2026-
|
|
308
|
+
declare const MODEL_POLICY_REVIEWED = "2026-11-12";
|
|
309
309
|
/**
|
|
310
310
|
* How long a review stays fresh before CI asks for another one.
|
|
311
311
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SCANNER_VERSION = "2.4.
|
|
2
|
+
var SCANNER_VERSION = "2.4.29";
|
|
3
3
|
|
|
4
4
|
// src/snippet.ts
|
|
5
5
|
var cacheContent = null;
|
|
@@ -892,7 +892,7 @@ function countPass(inlineAlready, suppressed) {
|
|
|
892
892
|
// src/models.ts
|
|
893
893
|
var MODEL_ANALYSIS = "claude-sonnet-5";
|
|
894
894
|
var MODEL_TRIAGE = "claude-haiku-5-5";
|
|
895
|
-
var MODEL_POLICY_REVIEWED = "2026-
|
|
895
|
+
var MODEL_POLICY_REVIEWED = "2026-11-12";
|
|
896
896
|
var MODEL_REVIEW_INTERVAL_DAYS = 30;
|
|
897
897
|
var MODEL_TEMPERATURE = 0;
|
|
898
898
|
|
|
@@ -10099,9 +10099,9 @@ function findingSecrets(f, fileContent, detections) {
|
|
|
10099
10099
|
if (hit) return hit;
|
|
10100
10100
|
const { lines } = windowLines(fileContent, f.line);
|
|
10101
10101
|
const secrets = [
|
|
10102
|
-
...detectedSecretValues(lines.join("\n"), f.file),
|
|
10103
|
-
...detectedSecretValues(f.description
|
|
10104
|
-
...detectedSecretValues(f.fix
|
|
10102
|
+
...detectedSecretValues(lines.join("\n"), promptText(f.file)),
|
|
10103
|
+
...detectedSecretValues(promptText(f.description), promptText(f.file)),
|
|
10104
|
+
...detectedSecretValues(promptText(f.fix), promptText(f.file))
|
|
10105
10105
|
];
|
|
10106
10106
|
detections?.set(f, secrets);
|
|
10107
10107
|
return secrets;
|
|
@@ -10149,16 +10149,16 @@ function buildReviewPromptWithSecrets(findings, fileContent, fence, detections)
|
|
|
10149
10149
|
const parts = [];
|
|
10150
10150
|
for (let i = 0; i < findings.length; i++) {
|
|
10151
10151
|
const f = findings[i];
|
|
10152
|
-
const description = f.description
|
|
10153
|
-
const fix = f.fix
|
|
10152
|
+
const description = promptText(f.description);
|
|
10153
|
+
const fix = promptText(f.fix);
|
|
10154
10154
|
const secrets = findingSecrets(f, fileContent, detections);
|
|
10155
10155
|
for (const secret of secrets) allSecrets.push(secret);
|
|
10156
10156
|
const context = prepareUntrustedSpan(getExpandedContext(fileContent, f.line, secrets), fence);
|
|
10157
10157
|
const maskedFix = outsideFenceField(applySecretMasks(fix, secrets));
|
|
10158
10158
|
parts.push(`--- Finding ${i} ---
|
|
10159
|
-
Rule: ${f.rule} (${outsideFenceField(f.title
|
|
10159
|
+
Rule: ${f.rule} (${outsideFenceField(promptText(f.title))})
|
|
10160
10160
|
Severity: ${f.severity}
|
|
10161
|
-
File: ${outsideFenceField(f.file
|
|
10161
|
+
File: ${outsideFenceField(promptText(f.file))}
|
|
10162
10162
|
Line: ${f.line}
|
|
10163
10163
|
Description: ${outsideFenceField(applySecretMasks(description, secrets))}
|
|
10164
10164
|
Suggested fix: ${maskedFix || "N/A"}
|
|
@@ -10211,10 +10211,10 @@ function batchBlobsContain(targets, fileContents, token) {
|
|
|
10211
10211
|
seen.add(finding.file);
|
|
10212
10212
|
if (hardenUntrustedPromptText(fileContents.get(finding.file) ?? "").includes(token)) return true;
|
|
10213
10213
|
}
|
|
10214
|
-
if (hardenUntrustedPromptText(finding.description
|
|
10215
|
-
if (hardenUntrustedPromptText(finding.fix
|
|
10216
|
-
if (hardenUntrustedPromptText(finding.title
|
|
10217
|
-
if (hardenUntrustedPromptText(finding.snippet
|
|
10214
|
+
if (hardenUntrustedPromptText(promptText(finding.description)).includes(token)) return true;
|
|
10215
|
+
if (hardenUntrustedPromptText(promptText(finding.fix)).includes(token)) return true;
|
|
10216
|
+
if (hardenUntrustedPromptText(promptText(finding.title)).includes(token)) return true;
|
|
10217
|
+
if (hardenUntrustedPromptText(promptText(finding.snippet)).includes(token)) return true;
|
|
10218
10218
|
}
|
|
10219
10219
|
return false;
|
|
10220
10220
|
}
|
|
@@ -10227,12 +10227,16 @@ function assignFileFences(targets, fileContents) {
|
|
|
10227
10227
|
const used = /* @__PURE__ */ new Set();
|
|
10228
10228
|
for (const file of files) {
|
|
10229
10229
|
let chosen = null;
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10230
|
+
try {
|
|
10231
|
+
for (let attempt = 0; attempt < FENCE_ATTEMPTS; attempt++) {
|
|
10232
|
+
const token = newDataFence();
|
|
10233
|
+
if (used.has(token) || batchBlobsContain(targets, fileContents, token)) continue;
|
|
10234
|
+
chosen = token;
|
|
10235
|
+
used.add(token);
|
|
10236
|
+
break;
|
|
10237
|
+
}
|
|
10238
|
+
} catch {
|
|
10239
|
+
chosen = null;
|
|
10236
10240
|
}
|
|
10237
10241
|
fences.set(file, chosen);
|
|
10238
10242
|
}
|
|
@@ -10250,6 +10254,9 @@ function placeholderFences(targets) {
|
|
|
10250
10254
|
function outsideFenceField(text) {
|
|
10251
10255
|
return sanitizePromptField(text, MAX_FIELD_CHARS);
|
|
10252
10256
|
}
|
|
10257
|
+
function promptText(value) {
|
|
10258
|
+
return typeof value === "string" ? value : "";
|
|
10259
|
+
}
|
|
10253
10260
|
function crossFilePrompt(targets, fileContents, fences, cacheFor) {
|
|
10254
10261
|
const fileNo = /* @__PURE__ */ new Map();
|
|
10255
10262
|
for (const target of targets) {
|
|
@@ -10270,12 +10277,12 @@ function crossFilePrompt(targets, fileContents, fences, cacheFor) {
|
|
|
10270
10277
|
const secrets = findingSecrets(finding, content, cacheFor(finding.file));
|
|
10271
10278
|
for (const secret of secrets) allSecrets.push(secret);
|
|
10272
10279
|
const context = prepareUntrustedSpan(getExpandedContext(content, finding.line, secrets), fence);
|
|
10273
|
-
const description = outsideFenceField(applySecretMasks(finding.description
|
|
10274
|
-
const fix = outsideFenceField(applySecretMasks(finding.fix
|
|
10280
|
+
const description = outsideFenceField(applySecretMasks(promptText(finding.description), secrets));
|
|
10281
|
+
const fix = outsideFenceField(applySecretMasks(promptText(finding.fix), secrets));
|
|
10275
10282
|
parts.push(`Scanner-assigned file ${no} index ${local}
|
|
10276
|
-
Rule: ${finding.rule} (${outsideFenceField(finding.title
|
|
10283
|
+
Rule: ${finding.rule} (${outsideFenceField(promptText(finding.title))})
|
|
10277
10284
|
Severity: ${finding.severity}
|
|
10278
|
-
File: ${outsideFenceField(finding.file
|
|
10285
|
+
File: ${outsideFenceField(promptText(finding.file))}
|
|
10279
10286
|
Line: ${finding.line}
|
|
10280
10287
|
Description: ${description}
|
|
10281
10288
|
Suggested fix: ${fix || "N/A"}
|
|
@@ -10447,15 +10454,48 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10447
10454
|
};
|
|
10448
10455
|
const reviewable = [];
|
|
10449
10456
|
for (const target of toReview) {
|
|
10450
|
-
|
|
10457
|
+
let prepared;
|
|
10458
|
+
try {
|
|
10459
|
+
const raw = target.finding;
|
|
10460
|
+
const finding = {
|
|
10461
|
+
...raw,
|
|
10462
|
+
title: promptText(raw.title),
|
|
10463
|
+
file: promptText(raw.file),
|
|
10464
|
+
snippet: promptText(raw.snippet),
|
|
10465
|
+
description: promptText(raw.description),
|
|
10466
|
+
fix: promptText(raw.fix)
|
|
10467
|
+
};
|
|
10468
|
+
outsideFenceField(finding.title);
|
|
10469
|
+
outsideFenceField(finding.file);
|
|
10470
|
+
outsideFenceField(finding.snippet);
|
|
10471
|
+
hardenUntrustedPromptText(finding.snippet);
|
|
10472
|
+
prepared = { ...target, finding };
|
|
10473
|
+
} catch {
|
|
10474
|
+
failedFindingCount += 1;
|
|
10475
|
+
continue;
|
|
10476
|
+
}
|
|
10477
|
+
if (fileContents.get(prepared.finding.file) === void 0) {
|
|
10451
10478
|
missingContentCount += 1;
|
|
10452
10479
|
continue;
|
|
10453
10480
|
}
|
|
10454
|
-
reviewable.push(
|
|
10481
|
+
reviewable.push(prepared);
|
|
10455
10482
|
}
|
|
10456
10483
|
const tierCount = new Set(reviewable.map((target) => severityTier(target))).size;
|
|
10457
10484
|
const callLimit = Math.ceil(Math.min(MAX_TOTAL_FINDINGS, 1e3) / MAX_FINDINGS_PER_BATCH) + Math.max(0, tierCount - 1);
|
|
10458
|
-
|
|
10485
|
+
let packed;
|
|
10486
|
+
try {
|
|
10487
|
+
packed = packAcrossFiles(reviewable, fileContents, cacheFor);
|
|
10488
|
+
} catch {
|
|
10489
|
+
packed = [];
|
|
10490
|
+
for (const target of reviewable) {
|
|
10491
|
+
try {
|
|
10492
|
+
packAcrossFiles([target], fileContents, cacheFor);
|
|
10493
|
+
packed.push([target]);
|
|
10494
|
+
} catch {
|
|
10495
|
+
failedFindingCount += 1;
|
|
10496
|
+
}
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10459
10499
|
const tasks = packed.slice(0, callLimit).map((targets) => ({ targets }));
|
|
10460
10500
|
let heldCount = 0;
|
|
10461
10501
|
for (const batch of packed.slice(callLimit)) heldCount += batch.length;
|
|
@@ -10578,19 +10618,23 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10578
10618
|
}
|
|
10579
10619
|
let unmatched = 0;
|
|
10580
10620
|
for (const target of sentTargets) {
|
|
10581
|
-
|
|
10582
|
-
|
|
10621
|
+
try {
|
|
10622
|
+
const list = byFinding.get(target.originalIndex);
|
|
10623
|
+
if (!list || list.length !== 1) {
|
|
10624
|
+
unmatched += 1;
|
|
10625
|
+
continue;
|
|
10626
|
+
}
|
|
10627
|
+
const r = list[0];
|
|
10628
|
+
reviewedIndices.add(target.originalIndex);
|
|
10629
|
+
if (r.verdict !== "fp") continue;
|
|
10630
|
+
const reason2 = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
|
|
10631
|
+
if (isProtectedFromAiRemoval(target.finding)) {
|
|
10632
|
+
policyRetainedMap.set(target.originalIndex, reason2);
|
|
10633
|
+
} else {
|
|
10634
|
+
fpMap.set(target.originalIndex, reason2);
|
|
10635
|
+
}
|
|
10636
|
+
} catch {
|
|
10583
10637
|
unmatched += 1;
|
|
10584
|
-
continue;
|
|
10585
|
-
}
|
|
10586
|
-
const r = list[0];
|
|
10587
|
-
reviewedIndices.add(target.originalIndex);
|
|
10588
|
-
if (r.verdict !== "fp") continue;
|
|
10589
|
-
const reason2 = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
|
|
10590
|
-
if (isProtectedFromAiRemoval(target.finding)) {
|
|
10591
|
-
policyRetainedMap.set(target.originalIndex, reason2);
|
|
10592
|
-
} else {
|
|
10593
|
-
fpMap.set(target.originalIndex, reason2);
|
|
10594
10638
|
}
|
|
10595
10639
|
}
|
|
10596
10640
|
if (unmatched > 0) {
|