xploitscan-shared-rules 2.4.29 → 2.4.31

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.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.29";
172
+ declare const SCANNER_VERSION = "2.4.31";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
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.29";
172
+ declare const SCANNER_VERSION = "2.4.31";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SCANNER_VERSION = "2.4.29";
2
+ var SCANNER_VERSION = "2.4.31";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -10354,11 +10354,12 @@ function parseReviewResponse(text) {
10354
10354
  file = Number(candidate.file);
10355
10355
  }
10356
10356
  const index = Number(candidate.index);
10357
+ const reason = !("reason" in candidate) || candidate.reason === void 0 ? "" : candidate.reason;
10357
10358
  valid.push({
10358
10359
  index,
10359
10360
  file,
10360
10361
  verdict: candidate.verdict,
10361
- reason: typeof candidate.reason === "string" ? candidate.reason : ""
10362
+ reason
10362
10363
  });
10363
10364
  }
10364
10365
  return valid;
@@ -10457,6 +10458,9 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10457
10458
  let prepared;
10458
10459
  try {
10459
10460
  const raw = target.finding;
10461
+ if (!Number.isInteger(raw.line) || raw.line < 1) {
10462
+ throw new Error("finding line");
10463
+ }
10460
10464
  const finding = {
10461
10465
  ...raw,
10462
10466
  title: promptText(raw.title),
@@ -10625,9 +10629,12 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10625
10629
  continue;
10626
10630
  }
10627
10631
  const r = list[0];
10632
+ if (typeof r.reason !== "string") {
10633
+ throw new TypeError("review reason");
10634
+ }
10635
+ const reason2 = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
10628
10636
  reviewedIndices.add(target.originalIndex);
10629
10637
  if (r.verdict !== "fp") continue;
10630
- const reason2 = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
10631
10638
  if (isProtectedFromAiRemoval(target.finding)) {
10632
10639
  policyRetainedMap.set(target.originalIndex, reason2);
10633
10640
  } else {