xploitscan-shared-rules 2.4.20 → 2.4.22

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SCANNER_VERSION = "2.4.20";
2
+ var SCANNER_VERSION = "2.4.22";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -71,18 +71,16 @@ function deduplicateFindings(findings) {
71
71
  }
72
72
 
73
73
  // src/silencing.ts
74
- function isInlineSilenced(content, matchIndex, ruleId) {
75
- const lines = content.split("\n");
76
- const matchLineNum = content.substring(0, matchIndex).split("\n").length - 1;
77
- return isLineSilenced(lines, matchLineNum, ruleId);
74
+ function isInlineSilenced(_content, _matchIndex, _ruleId) {
75
+ return false;
78
76
  }
79
77
  function isLineSilenced(lines, lineIdx, ruleId) {
80
78
  const matchLine = lines[lineIdx] ?? "";
81
79
  const marker = new RegExp(`(?://|/\\*|#|--)\\s*(?:${ruleId}|scanner)-OK\\b`, "i");
82
80
  if (marker.test(matchLine)) return true;
83
81
  const COMMENT_LINE = /^\s*[{(]?\s*(?:\/\/|#|\/\*|\*|--)/;
84
- const MAX_BLOCK_LINES = 20;
85
- for (let i = lineIdx - 1, seen = 0; i >= 0 && seen < MAX_BLOCK_LINES; i--, seen++) {
82
+ const MAX_BLOCK_LINES2 = 20;
83
+ for (let i = lineIdx - 1, seen = 0; i >= 0 && seen < MAX_BLOCK_LINES2; i--, seen++) {
86
84
  const line = lines[i] ?? "";
87
85
  if (marker.test(line)) return true;
88
86
  if (!COMMENT_LINE.test(line)) break;
@@ -90,6 +88,774 @@ function isLineSilenced(lines, lineIdx, ruleId) {
90
88
  return false;
91
89
  }
92
90
 
91
+ // src/suppression.ts
92
+ import ignore from "ignore";
93
+ var MAX_IGNORE_BYTES = 64 * 1024;
94
+ var MAX_IGNORE_LINES = 2e3;
95
+ var MAX_IGNORE_LINE_LEN = 1024;
96
+ var MAX_JUSTIFICATION = 200;
97
+ var MAX_WARNING_CAP = 20;
98
+ var MAX_SUPPRESSED_LIST = 500;
99
+ var MAX_COUNT = 1e3;
100
+ var MAX_BLOCK_LINES = 20;
101
+ var NESTED_IGNORE_WARNING = "nested .xploitscanignore ignored (only the root file is read here)";
102
+ var MARKER_SYNTAX = "use <ID>-OK inside a comment";
103
+ var RULE_ID_PATTERN = /^(?:[A-Za-z]{2,8}\d{0,4}|GL:[A-Za-z0-9-]{1,64}|scanner)$/i;
104
+ var SUPPRESSION_REGEXES = [RULE_ID_PATTERN];
105
+ var INLINE = /* @__PURE__ */ Symbol.for("xploitscan.inlineSuppressed");
106
+ function utf8ByteLength(text) {
107
+ return new TextEncoder().encode(text).length;
108
+ }
109
+ function isWellFormedRuleId(id) {
110
+ return RULE_ID_PATTERN.test(id);
111
+ }
112
+ function isBuiltinRuleId(id) {
113
+ if (!isWellFormedRuleId(id)) return false;
114
+ const u = id.toUpperCase();
115
+ if (u === "ENTROPY" || u === "SCANNER" || u === "AI") return true;
116
+ if (/^CFG\d{1,4}$/.test(u)) return true;
117
+ if (/^MFA\d{1,4}$/.test(u)) return true;
118
+ if (/^QA\d{1,4}$/.test(u)) return true;
119
+ if (/^GL:/i.test(id)) return true;
120
+ return false;
121
+ }
122
+ function clampCount(value, max = MAX_COUNT) {
123
+ const n = typeof value === "number" ? value : Number(value);
124
+ if (!Number.isFinite(n) || n < 0) return 0;
125
+ return Math.min(max, Math.floor(n));
126
+ }
127
+ function capWarnings(warnings, cap = MAX_WARNING_CAP) {
128
+ if (warnings.length <= cap) return { shown: warnings, extra: 0 };
129
+ return { shown: warnings.slice(0, cap), extra: warnings.length - cap };
130
+ }
131
+ function suppressionSummary(inline, ignoreFile) {
132
+ const n = inline + ignoreFile;
133
+ const noun = n === 1 ? "finding" : "findings";
134
+ return `${n} ${noun} suppressed (${inline} inline marker, ${ignoreFile} ignore file)`;
135
+ }
136
+ function warningForUpload(w) {
137
+ return { code: w.code, ruleIds: [...w.ruleIds], count: w.count };
138
+ }
139
+ function warningLine(w) {
140
+ if (w.code === "nested_ignored") return `${w.file} ${NESTED_IGNORE_WARNING}`;
141
+ const where = w.file ? `${w.file}:${w.line}` : `line ${w.line}`;
142
+ const ids = w.ruleIds.length ? ` ${w.ruleIds.join(",")}` : "";
143
+ const syntax = w.code === "unrecognized_marker" || w.code === "space_before_ok" ? ` ${MARKER_SYNTAX}` : "";
144
+ const more = w.code === "over_broad" ? ` suppresses all findings in ${w.count} files` : "";
145
+ return `${where} ${w.code}${ids}${more}${syntax}`;
146
+ }
147
+ function attachInlineSuppressed(findings, suppressed) {
148
+ Object.defineProperty(findings, INLINE, { value: suppressed, enumerable: false });
149
+ return findings;
150
+ }
151
+ function readInlineSuppressed(findings) {
152
+ if (!findings || typeof findings !== "object") return [];
153
+ const value = findings[INLINE];
154
+ return Array.isArray(value) ? value : [];
155
+ }
156
+ function publicSuppressedRecord(finding) {
157
+ const suppression = finding.suppression;
158
+ const info = suppression && typeof suppression === "object" ? {
159
+ kind: suppression.kind,
160
+ source: suppression.source,
161
+ ruleToken: suppression.ruleToken,
162
+ justification: String(suppression.justification ?? "").slice(
163
+ 0,
164
+ MAX_JUSTIFICATION
165
+ ),
166
+ declaredIn: suppression.declaredIn
167
+ } : void 0;
168
+ return {
169
+ rule: finding.rule,
170
+ file: finding.file,
171
+ line: finding.line,
172
+ severity: finding.severity,
173
+ ...info ? { suppression: info } : {}
174
+ };
175
+ }
176
+ function warn(file, line, code, ruleIds = [], count = 1) {
177
+ return { code, file, line, ruleIds, count };
178
+ }
179
+ function fateOf(id, opts) {
180
+ if (isBuiltinRuleId(id)) return "ok";
181
+ const upper = id.toUpperCase();
182
+ const pro = opts?.proIds;
183
+ if (pro && (pro.has(upper) || pro.has(id))) {
184
+ return opts?.tier === "pro" ? "ok" : "pro-silent";
185
+ }
186
+ if (!opts?.knownIds) return "ok";
187
+ if (opts.knownIds.has(upper) || opts.knownIds.has(id)) return "ok";
188
+ return "unknown";
189
+ }
190
+ function idEndingAt(text, end) {
191
+ const window = text.slice(Math.max(0, end - 80), end);
192
+ const gl = window.match(/GL:[A-Za-z0-9-]{1,64}$/i);
193
+ if (gl) {
194
+ const id2 = gl[0];
195
+ if (isWellFormedRuleId(id2)) return { id: id2, start: end - id2.length };
196
+ }
197
+ const plain = window.match(/[A-Za-z]{2,8}\d{0,4}$/);
198
+ if (!plain) return null;
199
+ const id = plain[0];
200
+ if (id.toLowerCase() === "ok") return null;
201
+ if (!isWellFormedRuleId(id)) return null;
202
+ return { id, start: end - id.length };
203
+ }
204
+ function idListBefore(text, end) {
205
+ const first = idEndingAt(text, end);
206
+ if (!first) return null;
207
+ const ids = [first.id];
208
+ let cursor = first.start;
209
+ while (cursor > 0) {
210
+ let j = cursor;
211
+ while (j > 0 && (text[j - 1] === " " || text[j - 1] === " ")) j--;
212
+ if (j > 0 && text[j - 1] === ",") {
213
+ j--;
214
+ while (j > 0 && (text[j - 1] === " " || text[j - 1] === " ")) j--;
215
+ } else if (j === cursor) {
216
+ break;
217
+ }
218
+ const prev = idEndingAt(text, j);
219
+ if (!prev || prev.start + prev.id.length !== j) break;
220
+ ids.unshift(prev.id);
221
+ cursor = prev.start;
222
+ }
223
+ return { ids, start: cursor };
224
+ }
225
+ function nextMarkerStart(rest) {
226
+ const lower = rest.toLowerCase();
227
+ let from = 0;
228
+ while (from < lower.length) {
229
+ const at = lower.indexOf("-ok", from);
230
+ if (at < 0) return -1;
231
+ const after = at + 3;
232
+ const next = lower[after];
233
+ if (next !== void 0 && /[A-Za-z0-9_]/.test(next)) {
234
+ from = at + 1;
235
+ continue;
236
+ }
237
+ let i = at - 1;
238
+ while (i >= 0 && /[A-Za-z0-9:-]/.test(lower[i] ?? "")) i--;
239
+ let start = i + 1;
240
+ while (start < at && !/[A-Za-z0-9]/.test(lower[start] ?? "")) start++;
241
+ if (start < at) return start;
242
+ from = at + 1;
243
+ }
244
+ return -1;
245
+ }
246
+ function parseCommentMarkers(comment, file, line, opts) {
247
+ const warnings = [];
248
+ const ids = [];
249
+ let justification = "";
250
+ const lower = comment.toLowerCase();
251
+ if (lower.includes("xploitscan") || lower.includes("ignore-line")) {
252
+ warnings.push(warn(file, line, "unrecognized_marker"));
253
+ }
254
+ let from = 0;
255
+ while (from < comment.length) {
256
+ const okAt = lower.indexOf("-ok", from);
257
+ const typoAt = lower.indexOf("-0k", from);
258
+ if (okAt < 0 && typoAt < 0) break;
259
+ const useTypo = typoAt >= 0 && (okAt < 0 || typoAt < okAt);
260
+ const at = useTypo ? typoAt : okAt;
261
+ const after = at + 3;
262
+ const boundary = after >= comment.length || !/[A-Za-z0-9]/.test(comment[after]);
263
+ if (!boundary) {
264
+ from = at + 1;
265
+ continue;
266
+ }
267
+ if (useTypo) {
268
+ const listed2 = idListBefore(comment, at);
269
+ warnings.push(
270
+ warn(
271
+ file,
272
+ line,
273
+ "unrecognized_marker",
274
+ listed2 ? listed2.ids.map((id) => id.toUpperCase()) : []
275
+ )
276
+ );
277
+ from = after;
278
+ continue;
279
+ }
280
+ const prev = at > 0 ? comment[at - 1] : "";
281
+ if (prev === " " || prev === " ") {
282
+ const listed2 = idListBefore(
283
+ comment.slice(0, at).trimEnd(),
284
+ comment.slice(0, at).trimEnd().length
285
+ );
286
+ warnings.push(
287
+ warn(file, line, "space_before_ok", listed2 ? listed2.ids.map((id) => id.toUpperCase()) : [])
288
+ );
289
+ from = after;
290
+ continue;
291
+ }
292
+ const listed = idListBefore(comment, at);
293
+ if (!listed) {
294
+ warnings.push(warn(file, line, "unrecognized_marker"));
295
+ from = after;
296
+ continue;
297
+ }
298
+ let just = "";
299
+ if (comment[after] === ":") {
300
+ const rest = comment.slice(after + 1);
301
+ const next = nextMarkerStart(rest);
302
+ just = (next >= 0 ? rest.slice(0, next) : rest).trim().slice(0, MAX_JUSTIFICATION);
303
+ }
304
+ if (!justification && just) justification = just;
305
+ for (const id of listed.ids) {
306
+ const fate = fateOf(id, opts);
307
+ if (fate === "unknown") {
308
+ warnings.push(warn(file, line, "unknown_rule_id", [id.toUpperCase()]));
309
+ continue;
310
+ }
311
+ if (fate === "pro-silent") continue;
312
+ ids.push(id.toUpperCase());
313
+ }
314
+ from = after;
315
+ }
316
+ return { ids, justification, warnings };
317
+ }
318
+ function commentOpenerAt(chars, i) {
319
+ const a = chars[i] ?? "";
320
+ const b = chars[i + 1] ?? "";
321
+ const two = a + b;
322
+ if (two === "//") return { kind: "line", len: 2 };
323
+ if (two === "/*") return { kind: "block", len: 2 };
324
+ if (two + (chars[i + 2] ?? "") + (chars[i + 3] ?? "") === "<!--") return { kind: "html", len: 4 };
325
+ if (a === "#" && (i === 0 || /\s/.test(chars[i - 1] ?? ""))) return { kind: "line", len: 1 };
326
+ if (two === "--" && (i === 0 || /\s/.test(chars[i - 1] ?? ""))) return { kind: "line", len: 2 };
327
+ return null;
328
+ }
329
+ function maskStringLiterals(line) {
330
+ const chars = line.split("");
331
+ const n = chars.length;
332
+ let i = 0;
333
+ while (i < n) {
334
+ const opener = commentOpenerAt(chars, i);
335
+ if (opener) {
336
+ if (opener.kind === "line") break;
337
+ if (opener.kind === "block") {
338
+ const end2 = line.indexOf("*/", i + opener.len);
339
+ i = end2 < 0 ? n : end2 + 2;
340
+ continue;
341
+ }
342
+ const end = line.indexOf("-->", i + opener.len);
343
+ i = end < 0 ? n : end + 3;
344
+ continue;
345
+ }
346
+ const c = chars[i];
347
+ if (c === '"' || c === "'") {
348
+ const q = c;
349
+ chars[i] = " ";
350
+ i++;
351
+ while (i < n) {
352
+ if (chars[i] === "\\") {
353
+ chars[i] = " ";
354
+ if (i + 1 < n) chars[i + 1] = " ";
355
+ i += 2;
356
+ continue;
357
+ }
358
+ if (chars[i] === q) {
359
+ chars[i] = " ";
360
+ i++;
361
+ break;
362
+ }
363
+ chars[i] = " ";
364
+ i++;
365
+ }
366
+ continue;
367
+ }
368
+ if (c === "`") {
369
+ chars[i] = " ";
370
+ i++;
371
+ let expr = 0;
372
+ while (i < n) {
373
+ if (expr === 0 && chars[i] === "\\") {
374
+ chars[i] = " ";
375
+ if (i + 1 < n) chars[i + 1] = " ";
376
+ i += 2;
377
+ continue;
378
+ }
379
+ if (expr === 0 && chars[i] === "`") {
380
+ chars[i] = " ";
381
+ i++;
382
+ break;
383
+ }
384
+ if (expr === 0 && chars[i] === "$" && chars[i + 1] === "{") {
385
+ chars[i] = " ";
386
+ chars[i + 1] = " ";
387
+ expr = 1;
388
+ i += 2;
389
+ continue;
390
+ }
391
+ if (expr > 0 && chars[i] === "{") {
392
+ expr++;
393
+ i++;
394
+ continue;
395
+ }
396
+ if (expr > 0 && chars[i] === "}") {
397
+ expr--;
398
+ if (expr === 0) chars[i] = " ";
399
+ i++;
400
+ continue;
401
+ }
402
+ if (expr === 0) chars[i] = " ";
403
+ i++;
404
+ }
405
+ continue;
406
+ }
407
+ i++;
408
+ }
409
+ return chars.join("");
410
+ }
411
+ function commentSpans(masked) {
412
+ const spans = [];
413
+ const n = masked.length;
414
+ let i = 0;
415
+ const code = true;
416
+ while (i < n) {
417
+ if (!code) {
418
+ i++;
419
+ continue;
420
+ }
421
+ const two = masked.slice(i, i + 2);
422
+ const four = masked.slice(i, i + 4);
423
+ if (four === "<!--") {
424
+ const end = masked.indexOf("-->", i + 4);
425
+ const stop = end < 0 ? n : end + 3;
426
+ spans.push([i, stop]);
427
+ i = stop;
428
+ continue;
429
+ }
430
+ if (two === "//") {
431
+ spans.push([i, n]);
432
+ break;
433
+ }
434
+ if (two === "/*") {
435
+ const end = masked.indexOf("*/", i + 2);
436
+ const stop = end < 0 ? n : end + 2;
437
+ spans.push([i, stop]);
438
+ i = stop;
439
+ continue;
440
+ }
441
+ if (masked[i] === "#" && (i === 0 || /\s/.test(masked[i - 1]))) {
442
+ spans.push([i, n]);
443
+ break;
444
+ }
445
+ if (two === "--" && (i === 0 || /\s/.test(masked[i - 1]))) {
446
+ spans.push([i, n]);
447
+ break;
448
+ }
449
+ i++;
450
+ }
451
+ const trimmed = masked.trim();
452
+ if (spans.length === 0 && (/^\*/.test(trimmed) || trimmed === "*/" || trimmed === "*/}" || trimmed === "-->")) {
453
+ spans.push([0, n]);
454
+ }
455
+ return spans;
456
+ }
457
+ function isBlankLine(line) {
458
+ return line.trim() === "";
459
+ }
460
+ function isCommentOnly(masked) {
461
+ const spans = commentSpans(masked);
462
+ if (spans.length === 0) return false;
463
+ const chars = masked.split("");
464
+ for (const [start, end] of spans) {
465
+ for (let i = start; i < end; i++) chars[i] = " ";
466
+ }
467
+ return /^[{}()\s]*$/.test(chars.join(""));
468
+ }
469
+ function targetLineFor(lines, maskedLines, markerLine) {
470
+ if (!isCommentOnly(maskedLines[markerLine] ?? "")) return markerLine;
471
+ let blanks = 0;
472
+ let comments = 0;
473
+ for (let i = markerLine + 1; i < lines.length; i++) {
474
+ if (isBlankLine(lines[i] ?? "")) {
475
+ blanks++;
476
+ if (blanks > 1) return null;
477
+ continue;
478
+ }
479
+ if (isCommentOnly(maskedLines[i] ?? "")) {
480
+ if (blanks > 0) return null;
481
+ comments++;
482
+ if (comments > MAX_BLOCK_LINES) return null;
483
+ continue;
484
+ }
485
+ return i;
486
+ }
487
+ return null;
488
+ }
489
+ function parseMarkers(lines, filePath = "", opts) {
490
+ const maskedLines = lines.map((line) => maskStringLiterals(line));
491
+ const markers = [];
492
+ const warnings = [];
493
+ for (let i = 0; i < lines.length; i++) {
494
+ const spans = commentSpans(maskedLines[i] ?? "");
495
+ if (spans.length === 0) continue;
496
+ const pieces = spans.map(([a, b]) => (maskedLines[i] ?? "").slice(a, b));
497
+ const parsed = parseCommentMarkers(pieces.join("\n"), filePath, i + 1, opts);
498
+ warnings.push(...parsed.warnings);
499
+ if (parsed.ids.length === 0) continue;
500
+ const target = targetLineFor(lines, maskedLines, i);
501
+ if (target === null) continue;
502
+ markers.push({
503
+ markerLine: i,
504
+ targetLine: target,
505
+ ruleIds: parsed.ids,
506
+ justification: parsed.justification,
507
+ declaredIn: `${filePath}:${i + 1}`
508
+ });
509
+ }
510
+ return { markers, warnings };
511
+ }
512
+ function buildMarkerIndex(lines, filePath = "", opts) {
513
+ const { markers, warnings } = parseMarkers(lines, filePath, opts);
514
+ const covers = (lineIdx, ruleId) => {
515
+ const want = ruleId.toUpperCase();
516
+ for (const marker of markers) {
517
+ if (marker.targetLine !== lineIdx) continue;
518
+ if (marker.ruleIds.includes("SCANNER") || marker.ruleIds.includes(want)) return marker;
519
+ }
520
+ return null;
521
+ };
522
+ return {
523
+ markers,
524
+ warnings,
525
+ covers(lineIdx, ruleId) {
526
+ return covers(lineIdx, ruleId) !== null;
527
+ },
528
+ info(lineIdx, ruleId) {
529
+ const hit = covers(lineIdx, ruleId);
530
+ if (!hit) return null;
531
+ const token = hit.ruleIds.includes(ruleId.toUpperCase()) ? ruleId.toUpperCase() : "SCANNER";
532
+ return { ruleToken: token, justification: hit.justification, declaredIn: hit.declaredIn };
533
+ }
534
+ };
535
+ }
536
+ function markerCoversLine(lines, lineIdx, ruleId) {
537
+ return buildMarkerIndex(lines, "").covers(lineIdx, ruleId);
538
+ }
539
+ function posix(p) {
540
+ return p.replace(/\\/g, "/").replace(/^\.\//, "");
541
+ }
542
+ function isRootIgnorePath(filePath) {
543
+ return posix(filePath) === ".xploitscanignore";
544
+ }
545
+ function splitIgnoreLine(line) {
546
+ let i = 0;
547
+ while (i < line.length && (line[i] === " " || line[i] === " ")) i++;
548
+ if (i < line.length && line[i] === "#") {
549
+ return { code: "", comment: line.slice(i + 1).trim(), escaped: false };
550
+ }
551
+ let code = "";
552
+ let escaped = false;
553
+ for (let k = 0; k < line.length; k++) {
554
+ const c = line[k] ?? "";
555
+ if (c === "\\") {
556
+ escaped = true;
557
+ code += c;
558
+ if (k + 1 < line.length) {
559
+ code += line[k + 1] ?? "";
560
+ k++;
561
+ }
562
+ continue;
563
+ }
564
+ if (c === "#" && k > 0 && (line[k - 1] === " " || line[k - 1] === " ")) {
565
+ return { code: code.trimEnd(), comment: line.slice(k + 1).trim(), escaped };
566
+ }
567
+ code += c;
568
+ }
569
+ return { code: code.trim(), comment: "", escaped };
570
+ }
571
+ function peelRules(code) {
572
+ const parts = code.split(/[ \t]+/).filter(Boolean);
573
+ const rules = [];
574
+ while (parts.length > 1) {
575
+ const last = parts[parts.length - 1] ?? "";
576
+ const ids = last.split(",").map((s) => s.trim()).filter(Boolean);
577
+ if (ids.length === 0 || !ids.every((id) => isWellFormedRuleId(id))) break;
578
+ rules.unshift(...ids);
579
+ parts.pop();
580
+ }
581
+ const pattern = parts.join(" ");
582
+ const unscoped = rules.length === 0 && /\s/.test(code.trim());
583
+ return { pattern, rules: rules.length ? rules : null, unscoped };
584
+ }
585
+ function patternRejected(pattern) {
586
+ if (pattern.includes("\0")) return true;
587
+ if (/^[A-Za-z]:/.test(pattern)) return true;
588
+ const norm = pattern.replace(/\\/g, "/");
589
+ if (/^[A-Za-z]:/.test(norm)) return true;
590
+ const body = norm.replace(/^!/, "");
591
+ if (body.split("/").includes("..")) return true;
592
+ const bare = body.replace(/^\.\//, "");
593
+ if (/^\/[^/*?\]]+$/.test(bare) && !bare.slice(1).includes("/")) return true;
594
+ return false;
595
+ }
596
+ function isOverBroad(pattern, rules) {
597
+ if (pattern.startsWith("!")) return false;
598
+ const body = pattern.replace(/^\.\//, "").replace(/^\//, "");
599
+ const broad = body === "*" || body === "**" || body === "**/*";
600
+ const all = rules === null || rules.some((r) => r.toUpperCase() === "SCANNER");
601
+ return broad && all;
602
+ }
603
+ function compilePattern(pattern) {
604
+ const neg = pattern.startsWith("!");
605
+ const body = (neg ? pattern.slice(1) : pattern).replace(/^\.\//, "");
606
+ return ignore().add(body);
607
+ }
608
+ function parseIgnoreFile(text, dirRel = "", opts) {
609
+ const declared = opts?.declaredPath ?? (dirRel ? `${posix(dirRel)}/.xploitscanignore` : ".xploitscanignore");
610
+ const dir = posix(dirRel).replace(/\/$/, "");
611
+ if (text.includes("\0")) {
612
+ return { entries: [], warnings: [warn(declared, 1, "binary")], ignoredWhole: true };
613
+ }
614
+ const bytes = utf8ByteLength(text);
615
+ const normalized = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
616
+ let rawLines = normalized.split("\n");
617
+ if (rawLines.length > 0 && rawLines[rawLines.length - 1] === "" && normalized.endsWith("\n")) {
618
+ rawLines = rawLines.slice(0, -1);
619
+ }
620
+ if (bytes > MAX_IGNORE_BYTES || rawLines.length > MAX_IGNORE_LINES) {
621
+ return { entries: [], warnings: [warn(declared, 1, "over_cap")], ignoredWhole: true };
622
+ }
623
+ const entries = [];
624
+ const warnings = [];
625
+ rawLines.forEach((raw, idx) => {
626
+ const lineNo = idx + 1;
627
+ if (raw.length > MAX_IGNORE_LINE_LEN) {
628
+ warnings.push(warn(declared, lineNo, "line_too_long"));
629
+ return;
630
+ }
631
+ const split = splitIgnoreLine(raw);
632
+ if (split.escaped) {
633
+ warnings.push(warn(declared, lineNo, "path_rejected"));
634
+ return;
635
+ }
636
+ const { code, comment } = split;
637
+ if (!code.trim() || code.trimStart().startsWith("#")) return;
638
+ const peeled = peelRules(code.trim());
639
+ if (!peeled.pattern) {
640
+ warnings.push(warn(declared, lineNo, "unrecognized_marker"));
641
+ return;
642
+ }
643
+ if (patternRejected(peeled.pattern)) {
644
+ warnings.push(warn(declared, lineNo, "path_rejected"));
645
+ return;
646
+ }
647
+ if (peeled.unscoped) {
648
+ warnings.push(warn(declared, lineNo, "unscoped_whitespace"));
649
+ return;
650
+ }
651
+ const accepted = [];
652
+ for (const id of peeled.rules ?? []) {
653
+ const fate = fateOf(id, opts);
654
+ if (fate === "unknown") {
655
+ warnings.push(warn(declared, lineNo, "unknown_rule_id", [id.toUpperCase()]));
656
+ continue;
657
+ }
658
+ if (fate === "pro-silent") continue;
659
+ accepted.push(id.toUpperCase());
660
+ }
661
+ if (peeled.rules && accepted.length === 0) return;
662
+ const pattern = peeled.pattern.replace(/\\/g, "/");
663
+ let matcher;
664
+ try {
665
+ matcher = compilePattern(pattern);
666
+ } catch {
667
+ warnings.push(warn(declared, lineNo, "path_rejected"));
668
+ return;
669
+ }
670
+ entries.push({
671
+ dirRel: dir,
672
+ pattern,
673
+ negated: pattern.startsWith("!"),
674
+ rules: peeled.rules ? new Set(accepted) : null,
675
+ justification: comment.slice(0, MAX_JUSTIFICATION),
676
+ declaredIn: `${declared}:${lineNo}`,
677
+ line: lineNo,
678
+ overBroad: isOverBroad(pattern, peeled.rules),
679
+ matcher
680
+ });
681
+ });
682
+ return { entries, warnings, ignoredWhole: false };
683
+ }
684
+ function parseIgnoreSources(sources, mode, opts) {
685
+ const entries = [];
686
+ const warnings = [];
687
+ const ordered = [...sources].sort((a, b) => posix(a.path).length - posix(b.path).length);
688
+ for (const source of ordered) {
689
+ const path = posix(source.path);
690
+ const root = isRootIgnorePath(path);
691
+ if (mode === "root-only" && !root) {
692
+ warnings.push(warn(path, 1, "nested_ignored"));
693
+ continue;
694
+ }
695
+ const dir = root ? "" : path.slice(0, Math.max(0, path.lastIndexOf("/")));
696
+ const parsed = parseIgnoreFile(source.text, dir, { ...opts, declaredPath: path });
697
+ entries.push(...parsed.entries);
698
+ warnings.push(...parsed.warnings);
699
+ }
700
+ return { entries, warnings };
701
+ }
702
+ function relativeTo(filePath, dirRel) {
703
+ const path = posix(filePath);
704
+ if (!dirRel) return path;
705
+ if (path === dirRel) return null;
706
+ if (path.startsWith(`${dirRel}/`)) return path.slice(dirRel.length + 1);
707
+ return null;
708
+ }
709
+ function matcherFor(entry) {
710
+ if (entry.matcher) return entry.matcher;
711
+ try {
712
+ entry.matcher = compilePattern(entry.pattern);
713
+ return entry.matcher;
714
+ } catch {
715
+ return null;
716
+ }
717
+ }
718
+ function entryMatches(entry, filePath) {
719
+ const rel = relativeTo(filePath, entry.dirRel);
720
+ if (rel === null || rel === "") return false;
721
+ const matcher = matcherFor(entry);
722
+ if (!matcher) return false;
723
+ try {
724
+ return matcher.ignores(rel);
725
+ } catch {
726
+ return false;
727
+ }
728
+ }
729
+ function matchIgnore(entries, filePath, ruleId) {
730
+ const rule = ruleId.toUpperCase();
731
+ let winner = null;
732
+ for (const entry of entries) {
733
+ if (!entryMatches(entry, filePath)) continue;
734
+ const applies = entry.rules === null || entry.rules.has("SCANNER") || entry.rules.has(rule);
735
+ if (!applies) continue;
736
+ winner = entry.negated ? null : entry;
737
+ }
738
+ return winner;
739
+ }
740
+ function filesMap(input) {
741
+ if (input instanceof Map) return input;
742
+ return new Map(Object.entries(input).map(([k, v]) => [posix(k), v]));
743
+ }
744
+ function applySuppressions(findings, input) {
745
+ const files = filesMap(input.filesByPath);
746
+ const opts = { knownIds: input.knownIds, proIds: input.proIds, tier: input.tier };
747
+ const entries = input.ignoreEntries ?? [];
748
+ const warnings = [];
749
+ const indexes = /* @__PURE__ */ new Map();
750
+ const indexFor = (file) => {
751
+ const key = posix(file);
752
+ const cached = indexes.get(key);
753
+ if (cached) return cached;
754
+ const text = files.get(key) ?? "";
755
+ const folded = text.toLowerCase();
756
+ if (!folded.includes("-ok") && !folded.includes("-0k")) {
757
+ const empty = {
758
+ markers: [],
759
+ warnings: [],
760
+ covers: () => false,
761
+ info: () => null
762
+ };
763
+ indexes.set(key, empty);
764
+ return empty;
765
+ }
766
+ const built = buildMarkerIndex(text.split("\n"), key, opts);
767
+ indexes.set(key, built);
768
+ warnings.push(...built.warnings);
769
+ return built;
770
+ };
771
+ const direct = /* @__PURE__ */ new Map();
772
+ for (const finding of findings) {
773
+ const info = indexFor(finding.file).info(finding.line - 1, finding.rule);
774
+ if (!info) continue;
775
+ direct.set(finding, {
776
+ kind: "inSource",
777
+ source: "marker",
778
+ ruleToken: info.ruleToken,
779
+ justification: info.justification,
780
+ declaredIn: info.declaredIn
781
+ });
782
+ }
783
+ const seenFiles = /* @__PURE__ */ new Set();
784
+ for (const file of files.keys()) seenFiles.add(posix(file));
785
+ for (const finding of findings) seenFiles.add(posix(finding.file));
786
+ for (const entry of entries) {
787
+ if (!entry.overBroad) continue;
788
+ let count = 0;
789
+ for (const file of seenFiles) if (entryMatches(entry, file)) count++;
790
+ if (count > 0)
791
+ warnings.push(
792
+ warn(entry.declaredIn.split(":")[0] ?? "", entry.line, "over_broad", [], count)
793
+ );
794
+ }
795
+ const kept = [];
796
+ const suppressed = [];
797
+ for (const finding of findings) {
798
+ const marker = direct.get(finding);
799
+ if (marker) {
800
+ suppressed.push({ ...finding, suppression: marker });
801
+ continue;
802
+ }
803
+ const hit = matchIgnore(entries, finding.file, finding.rule);
804
+ if (hit) {
805
+ suppressed.push({
806
+ ...finding,
807
+ suppression: {
808
+ kind: "external",
809
+ source: "ignore-file",
810
+ ruleToken: finding.rule.toUpperCase(),
811
+ justification: hit.justification,
812
+ declaredIn: hit.declaredIn
813
+ }
814
+ });
815
+ continue;
816
+ }
817
+ kept.push(finding);
818
+ }
819
+ return { kept, suppressed, warnings };
820
+ }
821
+ function isRuleScopedIgnoreLine(line) {
822
+ const split = splitIgnoreLine(line.replace(/\r$/, ""));
823
+ if (split.escaped) return false;
824
+ const { code } = split;
825
+ if (!code.trim() || code.trimStart().startsWith("#")) return false;
826
+ const peeled = peelRules(code.trim());
827
+ return peeled.rules !== null && peeled.rules.length > 0 && !patternRejected(peeled.pattern);
828
+ }
829
+ function isUnscopedOverBroadLine(line) {
830
+ const split = splitIgnoreLine(line.replace(/\r$/, ""));
831
+ if (split.escaped) return false;
832
+ const { code } = split;
833
+ if (!code.trim() || code.trimStart().startsWith("#")) return false;
834
+ const peeled = peelRules(code.trim());
835
+ if (peeled.rules && peeled.rules.length > 0) return false;
836
+ return isOverBroad(peeled.pattern, null);
837
+ }
838
+ var SCAN_META = /* @__PURE__ */ Symbol.for("xploitscan.scanSuppression");
839
+ function attachScanSuppression(findings, meta) {
840
+ Object.defineProperty(findings, SCAN_META, { value: meta, enumerable: false });
841
+ return findings;
842
+ }
843
+ function readScanSuppression(findings) {
844
+ if (!findings || typeof findings !== "object") return null;
845
+ const value = findings[SCAN_META];
846
+ if (!value || typeof value !== "object") return null;
847
+ return value;
848
+ }
849
+ function countPass(inlineAlready, suppressed) {
850
+ let ignoreFile = 0;
851
+ let inline = inlineAlready;
852
+ for (const item of suppressed) {
853
+ if (item.suppression.source === "ignore-file") ignoreFile++;
854
+ else inline++;
855
+ }
856
+ return { inline, ignoreFile };
857
+ }
858
+
93
859
  // src/models.ts
94
860
  var MODEL_ANALYSIS = "claude-sonnet-5";
95
861
  var MODEL_TRIAGE = "claude-haiku-5-5";
@@ -1873,18 +2639,8 @@ function isInsideFixMessage(content, matchIndex) {
1873
2639
  const lineText = lineTextAt(content, matchIndex);
1874
2640
  return /(?:fix|description|message|suggestion|hint|help|example|doc|comment)\s*[:=]\s*["'`]/i.test(lineText) || /return\s*["'`].*\b(?:Use|Replace|Add|Move|Set|Enable|Disable|Never|Don't|Do not|Instead)\b/i.test(lineText);
1875
2641
  }
1876
- function filterSilenced(matches, content, ruleId) {
1877
- if (matches.length === 0) return matches;
1878
- const lines = content.split("\n");
1879
- const silencedByLine = /* @__PURE__ */ new Map();
1880
- return matches.filter((m) => {
1881
- let silenced = silencedByLine.get(m.line);
1882
- if (silenced === void 0) {
1883
- silenced = isLineSilenced(lines, m.line - 1, ruleId);
1884
- silencedByLine.set(m.line, silenced);
1885
- }
1886
- return !silenced;
1887
- });
2642
+ function filterSilenced(matches, _content, _ruleId) {
2643
+ return matches;
1888
2644
  }
1889
2645
  function lineStartOffsets(content) {
1890
2646
  const starts = [0];
@@ -3934,7 +4690,6 @@ var unvalidatedRedirect = {
3934
4690
  let m;
3935
4691
  let commentLineStart = -1;
3936
4692
  let commentLine = false;
3937
- let silenceLines;
3938
4693
  while ((m = navPattern.exec(content)) !== null) {
3939
4694
  const navLineStart = content.lastIndexOf("\n", m.index - 1) + 1;
3940
4695
  if (navLineStart !== commentLineStart) {
@@ -3947,7 +4702,6 @@ var unvalidatedRedirect = {
3947
4702
  const isPureLiteral = /^["'`][^"'`]*["'`]$/.test(value);
3948
4703
  if (!hasInterpolation && isPureLiteral) continue;
3949
4704
  const line = lineNumberAt(content, m.index);
3950
- if (isLineSilenced(silenceLines ??= content.split("\n"), line - 1, "VC016")) continue;
3951
4705
  matches.push({
3952
4706
  rule: "VC016",
3953
4707
  title: unvalidatedRedirect.title,
@@ -5176,7 +5930,6 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5176
5930
  const sbomFile = isSbomPath(filePath);
5177
5931
  const vendoredFile = isVendoredPath(filePath);
5178
5932
  const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
5179
- const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
5180
5933
  for (const rule of ruleset) {
5181
5934
  if (disabledRules.includes(rule.id)) continue;
5182
5935
  if (sbomFile && rule.category !== "Secrets") continue;
@@ -5185,9 +5938,6 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5185
5938
  const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
5186
5939
  const onTestPath = isTestPath(filePath);
5187
5940
  for (const match of matches) {
5188
- if (silenceableLines && isLineSilenced(silenceableLines, match.line - 1, match.rule)) {
5189
- continue;
5190
- }
5191
5941
  const live = isLive({
5192
5942
  rule: match.rule,
5193
5943
  category: match.category,
@@ -5216,7 +5966,10 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5216
5966
  });
5217
5967
  }
5218
5968
  }
5219
- return deduplicateFindings(findings);
5969
+ const deduped = deduplicateFindings(findings);
5970
+ if (!/-OK\b/i.test(content)) return deduped;
5971
+ const applied = applySuppressions(deduped, { filesByPath: { [filePath]: content } });
5972
+ return attachInlineSuppressed(applied.kept, applied.suppressed);
5220
5973
  }
5221
5974
 
5222
5975
  // src/rule-counts.ts
@@ -5683,6 +6436,7 @@ function entropySecretValues(filePath, content) {
5683
6436
  }
5684
6437
  function scanEntropyFiles(files, collect) {
5685
6438
  const findings = [];
6439
+ const inlineDropped = [];
5686
6440
  for (const { path: filePath, content } of files) {
5687
6441
  if (SKIP_FILES.test(filePath)) continue;
5688
6442
  if (SKIP_FILENAMES.test(filePath)) continue;
@@ -5696,6 +6450,8 @@ function scanEntropyFiles(files, collect) {
5696
6450
  const vendored = isVendoredPath(filePath);
5697
6451
  const dotenv = isDotenvPath(filePath) && !DOTENV_EXAMPLE_RE.test(filePath);
5698
6452
  const lines = content.split("\n");
6453
+ const folded = content.toLowerCase();
6454
+ const markerIndex = folded.includes("-ok") || folded.includes("-0k") ? buildMarkerIndex(lines, filePath) : null;
5699
6455
  let verificationDepth = -1;
5700
6456
  let braceDepth = 0;
5701
6457
  for (let i = 0; i < lines.length; i++) {
@@ -5794,7 +6550,6 @@ function scanEntropyFiles(files, collect) {
5794
6550
  }
5795
6551
  let safeWords;
5796
6552
  let verificationMeta;
5797
- let silenced;
5798
6553
  let snippet;
5799
6554
  const seenValues = /* @__PURE__ */ new Set();
5800
6555
  for (const { value, beforeAssign, dotenvName, variableName, contextFrom, contextTo } of candidates) {
@@ -5838,8 +6593,21 @@ function scanEntropyFiles(files, collect) {
5838
6593
  if (dotenvName && /(?:^|_)IDS?$/i.test(dotenvName) && !isSecretVariableName(dotenvName)) continue;
5839
6594
  const isLikelySecret = isSecretVariableName(varName) || publicEnv?.secret === true;
5840
6595
  if (entropy < 4.5 && !isLikelySecret) continue;
5841
- if (silenced === void 0) silenced = isLineSilenced(lines, i, "ENTROPY");
5842
- if (silenced) continue;
6596
+ if (markerIndex?.covers(i, "ENTROPY")) {
6597
+ inlineDropped.push({
6598
+ id: `ENTROPY-${filePath}:${i + 1}`,
6599
+ rule: "ENTROPY",
6600
+ severity: "high",
6601
+ title: "High-Entropy String Detected (Possible Secret)",
6602
+ description: "",
6603
+ file: filePath,
6604
+ line: i + 1,
6605
+ snippet: "",
6606
+ category: "Secrets",
6607
+ source: "custom"
6608
+ });
6609
+ continue;
6610
+ }
5843
6611
  collect?.push(value);
5844
6612
  const masked = maskSecretValue(value);
5845
6613
  if (snippet === void 0) snippet = getSnippet2(lines, i + 1);
@@ -5865,7 +6633,256 @@ function scanEntropyFiles(files, collect) {
5865
6633
  }
5866
6634
  }
5867
6635
  }
5868
- return findings;
6636
+ return attachInlineSuppressed(findings, inlineDropped);
6637
+ }
6638
+
6639
+ // src/ai-status-constants.ts
6640
+ var AI_STATUSES = ["reviewed", "partial", "skipped", "failed", "unknown"];
6641
+ var AI_REASONS = [
6642
+ "no_api_key",
6643
+ "client_init",
6644
+ "capped",
6645
+ "budget_timeout",
6646
+ "model_bad_output",
6647
+ "model_error",
6648
+ "missing_content",
6649
+ "exception",
6650
+ "opted_out",
6651
+ "auth_failed",
6652
+ "jti_missing",
6653
+ "token_unverified",
6654
+ "pro_rules_unavailable",
6655
+ "engine_unavailable",
6656
+ "upload_failed",
6657
+ "upload_blocked",
6658
+ "upload_duplicate",
6659
+ "persist_failed",
6660
+ "quality_unavailable",
6661
+ "intent_unavailable",
6662
+ "not_supported",
6663
+ "token_secret_missing",
6664
+ "rate_limited",
6665
+ "jti_unavailable",
6666
+ "credit_error",
6667
+ "daily_limit",
6668
+ "signed_out"
6669
+ ];
6670
+ var AI_SURFACES = ["upload", "cli", "action", "app", "api", "mcp", "web", "save"];
6671
+ var PLAN_CAUSES = [
6672
+ "missing",
6673
+ "malformed",
6674
+ "expired",
6675
+ "revoked",
6676
+ "network",
6677
+ "upstream_5xx",
6678
+ "unknown"
6679
+ ];
6680
+ var WEBHOOK_REASONS = [
6681
+ "no_metadata_user",
6682
+ "malformed_user",
6683
+ "unknown_user",
6684
+ "user_bound_other_customer",
6685
+ "race_no_row",
6686
+ "deleted_unmatched",
6687
+ "clerk_lookup_failed"
6688
+ ];
6689
+ var WEBHOOK_EVENT_TYPES = [
6690
+ "checkout.session.completed",
6691
+ "customer.subscription.created",
6692
+ "customer.subscription.updated",
6693
+ "customer.subscription.deleted",
6694
+ "invoice.paid",
6695
+ "invoice.payment_failed",
6696
+ "created",
6697
+ "updated"
6698
+ ];
6699
+
6700
+ // src/ai-status.ts
6701
+ var PLAN_UNVERIFIED_NOTICE = "Couldn't verify your plan, scanned with free rules only.";
6702
+ var FAIL_REASONS = /* @__PURE__ */ new Set([
6703
+ "budget_timeout",
6704
+ "model_error",
6705
+ "model_bad_output",
6706
+ "auth_failed",
6707
+ "exception",
6708
+ "client_init"
6709
+ ]);
6710
+ function clampCount2(raw) {
6711
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw < 0) return 0;
6712
+ return Math.min(Math.trunc(raw), 1e6);
6713
+ }
6714
+ function isStatus(raw) {
6715
+ return typeof raw === "string" && AI_STATUSES.includes(raw);
6716
+ }
6717
+ function isReason(raw) {
6718
+ return typeof raw === "string" && AI_REASONS.includes(raw);
6719
+ }
6720
+ function isSurface(raw) {
6721
+ return typeof raw === "string" && AI_SURFACES.includes(raw);
6722
+ }
6723
+ function bucketFiles(n) {
6724
+ if (typeof n !== "number" || !Number.isFinite(n) || n <= 0) return "0";
6725
+ const v = Math.trunc(n);
6726
+ if (v < 5) return "1-4";
6727
+ if (v < 20) return "5-19";
6728
+ return "20+";
6729
+ }
6730
+ function planCause(specific) {
6731
+ switch (specific) {
6732
+ case "secret_missing":
6733
+ return "missing";
6734
+ case "bad_shape":
6735
+ case "sig_mismatch":
6736
+ case "sig_length_mismatch":
6737
+ case "hmac_error":
6738
+ case "payload_parse_error":
6739
+ case "uid_or_tier_wrong_type":
6740
+ return "malformed";
6741
+ case "expired":
6742
+ case "exp_missing_or_nan":
6743
+ return "expired";
6744
+ case "tier_not_paid_unknown_value":
6745
+ case "http_401":
6746
+ case "http_403":
6747
+ return "revoked";
6748
+ case "no_cached_bundle_and_network_error":
6749
+ case "timeout":
6750
+ case "network":
6751
+ return "network";
6752
+ case "http_5xx":
6753
+ case "upstream_5xx":
6754
+ return "upstream_5xx";
6755
+ default:
6756
+ return "unknown";
6757
+ }
6758
+ }
6759
+ function toAiDegraded(input = {}) {
6760
+ const total = clampCount2(input.total);
6761
+ let reviewed = clampCount2(input.reviewed);
6762
+ let capped = clampCount2(input.capped);
6763
+ if (reviewed > total) reviewed = total;
6764
+ if (reviewed + capped > total) capped = total - reviewed;
6765
+ const unreviewed = total - reviewed - capped;
6766
+ let status = isStatus(input.status) ? input.status : "unknown";
6767
+ let reason = isReason(input.reason) ? input.reason : null;
6768
+ const eligible = total - capped;
6769
+ if (status === "reviewed" && reviewed !== eligible) {
6770
+ status = reviewed === 0 && reason != null && FAIL_REASONS.has(reason) ? "failed" : "partial";
6771
+ }
6772
+ if (status === "reviewed" && unreviewed > 0) status = "partial";
6773
+ if (status === "skipped" && reason != null && FAIL_REASONS.has(reason)) status = "failed";
6774
+ if (status === "reviewed" || status === "unknown") {
6775
+ if (status === "unknown") reason = null;
6776
+ }
6777
+ const modelStatus = reason === "model_error" && typeof input.modelStatus === "number" && Number.isFinite(input.modelStatus) ? Math.trunc(input.modelStatus) : null;
6778
+ return {
6779
+ status,
6780
+ reason,
6781
+ surface: isSurface(input.surface) ? input.surface : "cli",
6782
+ total,
6783
+ reviewed,
6784
+ unreviewed,
6785
+ capped,
6786
+ modelStatus
6787
+ };
6788
+ }
6789
+ function unknownAiStatus(surface = "save") {
6790
+ return toAiDegraded({ status: "unknown", reason: null, surface, total: 0, reviewed: 0, unreviewed: 0, capped: 0 });
6791
+ }
6792
+ function aiStatusLine(d) {
6793
+ const shown = Math.max(0, d.total - d.capped);
6794
+ switch (d.reason) {
6795
+ case "no_api_key":
6796
+ return "AI review skipped: no Anthropic API key is set.";
6797
+ case "opted_out":
6798
+ return "AI review skipped: user opted out.";
6799
+ case "not_supported":
6800
+ return "AI review not run on MCP scans.";
6801
+ case "auth_failed":
6802
+ return "AI review failed: the Anthropic API key was rejected.";
6803
+ case "capped":
6804
+ return `AI review covered the first ${shown} of ${d.total} findings.`;
6805
+ case "budget_timeout":
6806
+ return d.status === "failed" ? `AI review failed: every batch timed out (${d.reviewed} reviewed, ${d.unreviewed} unreviewed, ${d.capped} capped, ${d.total} total).` : `AI review was partial: the time limit ran out (${d.reviewed} reviewed of ${d.total}).`;
6807
+ case "client_init":
6808
+ return "AI review failed: the AI client could not start.";
6809
+ case "model_bad_output":
6810
+ return "AI review failed: the model returned unusable output.";
6811
+ case "model_error":
6812
+ return `AI review failed: the model request was rejected (HTTP ${d.modelStatus ?? "error"}).`;
6813
+ case "missing_content":
6814
+ return "AI review was partial: source content was missing for some findings.";
6815
+ case "exception":
6816
+ return "AI review failed: an unexpected error occurred.";
6817
+ case "token_secret_missing":
6818
+ return "AI review skipped: scan token verification is not configured.";
6819
+ case "rate_limited":
6820
+ return "AI review skipped: rate limited.";
6821
+ case "jti_unavailable":
6822
+ return "AI review skipped: the review token could not be checked in time.";
6823
+ case "jti_missing":
6824
+ return "AI review skipped: the review token had no single-use id.";
6825
+ case "credit_error":
6826
+ return "AI review skipped: the review credit could not be spent.";
6827
+ case "daily_limit":
6828
+ return "AI review skipped: daily limit reached.";
6829
+ case "signed_out":
6830
+ return "AI review skipped: signed out.";
6831
+ case "quality_unavailable":
6832
+ return "Quality checks were unavailable for this scan.";
6833
+ case "intent_unavailable":
6834
+ return "Intent check was unavailable for this scan.";
6835
+ case "engine_unavailable":
6836
+ return "A scan engine was unavailable.";
6837
+ case "upload_failed":
6838
+ return "The scan could not be uploaded.";
6839
+ case "upload_blocked":
6840
+ return "The scan was not uploaded: the plan limit blocked it.";
6841
+ case "upload_duplicate":
6842
+ return "The scan was already uploaded for this job.";
6843
+ case "persist_failed":
6844
+ return "The scan status could not be stored.";
6845
+ case "token_unverified":
6846
+ case "pro_rules_unavailable":
6847
+ return PLAN_UNVERIFIED_NOTICE;
6848
+ default:
6849
+ if (d.status === "reviewed") return "AI review completed.";
6850
+ if (d.status === "unknown") return "AI review status is unknown.";
6851
+ if (d.status === "partial") return `AI review was partial: ${d.reviewed} of ${d.total} findings reviewed.`;
6852
+ if (d.status === "failed") return "AI review failed.";
6853
+ return "AI review skipped.";
6854
+ }
6855
+ }
6856
+ var SCAN_AI_DEGRADED_KEYS = [
6857
+ "status",
6858
+ "reason",
6859
+ "surface",
6860
+ "total",
6861
+ "reviewed",
6862
+ "capped",
6863
+ "files_received_bucket"
6864
+ ];
6865
+ function scanAiDegradedProps(d, filesReceived) {
6866
+ return {
6867
+ status: d.status,
6868
+ reason: d.reason,
6869
+ surface: d.surface,
6870
+ total: d.total,
6871
+ reviewed: d.reviewed,
6872
+ capped: d.capped,
6873
+ files_received_bucket: bucketFiles(filesReceived)
6874
+ };
6875
+ }
6876
+ var SCAN_TOKEN_NULL_KEYS = ["cause", "surface", "tier_expected"];
6877
+ function scanTokenNullProps(cause, surface) {
6878
+ const safeSurface = isSurface(surface) ? surface : "api";
6879
+ return { cause, surface: safeSurface, tier_expected: "paid" };
6880
+ }
6881
+ var BILLING_WEBHOOK_UNMATCHED_KEYS = ["type", "reason", "final"];
6882
+ function billingWebhookUnmatchedProps(input) {
6883
+ const reason = typeof input.reason === "string" && WEBHOOK_REASONS.includes(input.reason) ? input.reason : "race_no_row";
6884
+ const type = typeof input.type === "string" && input.type.length > 0 && input.type.length < 80 ? input.type : "unknown";
6885
+ return { type, reason, final: input.final === true };
5869
6886
  }
5870
6887
 
5871
6888
  // src/ai-fp-filter.ts
@@ -5927,6 +6944,15 @@ var AI_FILTER_BUDGET_MS = (() => {
5927
6944
  return Math.min(n, 6e4);
5928
6945
  })();
5929
6946
  var PER_CALL_TIMEOUT_MS = 8e3;
6947
+ function perCallTimeoutMs(budgetMs) {
6948
+ const budget = Number.isFinite(budgetMs) && budgetMs >= 1 ? Math.min(Math.trunc(budgetMs), 6e4) : DEFAULT_AI_FILTER_BUDGET_MS;
6949
+ const scaled = Math.floor(budget * 0.6);
6950
+ const perCall = Math.min(PER_CALL_TIMEOUT_MS, scaled);
6951
+ return perCall;
6952
+ }
6953
+ if (!(perCallTimeoutMs(AI_FILTER_BUDGET_MS) < AI_FILTER_BUDGET_MS)) {
6954
+ throw new Error("per-call AI timeout must be strictly below the filter budget");
6955
+ }
5930
6956
  function isAbortError(err) {
5931
6957
  if (!err || typeof err !== "object") return false;
5932
6958
  const name = "name" in err ? String(err.name) : "";
@@ -5939,6 +6965,16 @@ function isTimeoutError(err) {
5939
6965
  const message = err instanceof Error ? err.message : String(err);
5940
6966
  return /\b(?:request|connection|operation|model call)\s+(?:has\s+)?timed out\b/i.test(message) || /\bETIMEDOUT\b/i.test(message);
5941
6967
  }
6968
+ function errorHttpStatus(err) {
6969
+ if (!err || typeof err !== "object") return null;
6970
+ const status = err.status;
6971
+ return typeof status === "number" && Number.isFinite(status) ? Math.trunc(status) : null;
6972
+ }
6973
+ function callWasAborted(err) {
6974
+ if (!err || typeof err !== "object") return false;
6975
+ const name = "name" in err ? String(err.name) : "";
6976
+ return name === "AbortError" || name === "APIUserAbortError";
6977
+ }
5942
6978
  var SEVERITY_PRIORITY = {
5943
6979
  critical: 0,
5944
6980
  high: 1,
@@ -6088,8 +7124,10 @@ function parseReviewResponse(text) {
6088
7124
  return null;
6089
7125
  }
6090
7126
  }
6091
- async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER_BUDGET_MS) {
6092
- const empty = {
7127
+ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER_BUDGET_MS, options) {
7128
+ const surface = options?.surface ?? "cli";
7129
+ const emptyMask = { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 };
7130
+ const early = (status2, reason2, extra) => ({
6093
7131
  findings,
6094
7132
  filteredFindings: [],
6095
7133
  policyRetainedFindings: [],
@@ -6097,15 +7135,27 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6097
7135
  removedCount: 0,
6098
7136
  policyRetainedCount: 0,
6099
7137
  totalBefore: findings.length,
6100
- reviewedCount: 0,
6101
- unreviewedCount: findings.length,
6102
- cappedCount: 0,
7138
+ reviewedCount: extra?.reviewed ?? 0,
7139
+ unreviewedCount: extra?.unreviewed ?? findings.length,
7140
+ cappedCount: extra?.capped ?? 0,
6103
7141
  missingContentCount: 0,
6104
7142
  timedOut: false,
6105
- maskStats: { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 }
6106
- };
6107
- if (findings.length === 0) return empty;
6108
- if (!process.env.ANTHROPIC_API_KEY) return empty;
7143
+ maskStats: emptyMask,
7144
+ aiDegraded: toAiDegraded({
7145
+ status: status2,
7146
+ reason: reason2,
7147
+ surface,
7148
+ total: findings.length,
7149
+ reviewed: extra?.reviewed ?? 0,
7150
+ unreviewed: extra?.unreviewed ?? findings.length,
7151
+ capped: extra?.capped ?? 0,
7152
+ modelStatus: extra?.modelStatus ?? null
7153
+ })
7154
+ });
7155
+ if (findings.length === 0) {
7156
+ return early("reviewed", null, { reviewed: 0, unreviewed: 0, capped: 0 });
7157
+ }
7158
+ if (!process.env.ANTHROPIC_API_KEY) return early("skipped", "no_api_key");
6109
7159
  const deadlineMs = Date.now() + Math.max(0, budgetMs);
6110
7160
  const abortController = new AbortController();
6111
7161
  let budgetExpired = budgetMs <= 0;
@@ -6135,12 +7185,20 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6135
7185
  try {
6136
7186
  client = new Anthropic();
6137
7187
  } catch {
6138
- return empty;
7188
+ if (budgetTimer) clearTimeout(budgetTimer);
7189
+ return early("failed", "client_init", {
7190
+ reviewed: 0,
7191
+ capped: overflow.length,
7192
+ unreviewed: findings.length - overflow.length
7193
+ });
6139
7194
  }
6140
7195
  const fpMap = /* @__PURE__ */ new Map();
6141
7196
  const policyRetainedMap = /* @__PURE__ */ new Map();
6142
7197
  const reviewedIndices = /* @__PURE__ */ new Set();
6143
7198
  let firstError = null;
7199
+ let firstErrorStatus = null;
7200
+ let authFailed = false;
7201
+ let badOutput = false;
6144
7202
  const maskStats = { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 };
6145
7203
  let failedBatches = 0;
6146
7204
  let timedOutCount = 0;
@@ -6166,9 +7224,11 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6166
7224
  const reviewBatch = async (task) => {
6167
7225
  const { targets, content, detections } = task;
6168
7226
  const batch = targets.map((target) => target.finding);
6169
- if (abortController.signal.aborted || Date.now() >= deadlineMs) {
6170
- budgetExpired = true;
6171
- timedOutCount += batch.length;
7227
+ if (authFailed || abortController.signal.aborted || Date.now() >= deadlineMs) {
7228
+ if (!authFailed) {
7229
+ budgetExpired = true;
7230
+ timedOutCount += batch.length;
7231
+ }
6172
7232
  return;
6173
7233
  }
6174
7234
  try {
@@ -6180,7 +7240,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6180
7240
  maskStats.masked_count += proof.detected - proof.raw;
6181
7241
  maskStats.raw_after_mask += proof.raw;
6182
7242
  if (proof.detected > 0) maskStats.had_secret_pattern = true;
6183
- console.info(
7243
+ console.error(
6184
7244
  `[ai-fp-filter] batch prompt ${prompt.length} chars (~${Math.ceil(prompt.length / 4)} tokens), ${batch.length} finding(s)`
6185
7245
  );
6186
7246
  if (prompt.length > MAX_BATCH_PROMPT_CHARS) {
@@ -6188,38 +7248,52 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6188
7248
  `[ai-fp-filter] batch prompt ${prompt.length} chars exceeds ${MAX_BATCH_PROMPT_CHARS} cap (single oversized finding after truncation)`
6189
7249
  );
6190
7250
  }
6191
- const response = await client.messages.create(
6192
- {
6193
- model: MODEL_TRIAGE,
6194
- max_tokens: 2048,
6195
- // Haiku 5.5 rejects non-default sampling params with HTTP 400
6196
- // ("temperature is deprecated for this model"). Omit temperature /
6197
- // top_p / top_k entirely — do NOT send MODEL_TEMPERATURE (0).
6198
- // Adaptive thinking is on by default for 5.5; disable it here: this
6199
- // is binary FP classification, not open-ended analysis, and thinking
6200
- // burns the shared AI budget (Isobar rescan: every call 400'd on
6201
- // temperature, then timed_out with aiReviewed:false → grade D).
6202
- thinking: { type: "disabled" },
6203
- system: REVIEW_SYSTEM_PROMPT,
6204
- messages: [{ role: "user", content: prompt }]
6205
- },
6206
- // Shared AbortController plus a per-call timeout capped at remaining
6207
- // budget. Previously 20s with no overall deadline.
6208
- { timeout: Math.min(PER_CALL_TIMEOUT_MS, remaining), signal: abortController.signal }
6209
- );
7251
+ const perCall = perCallTimeoutMs(budgetMs);
7252
+ const callTimeout = Math.min(perCall, remaining);
7253
+ const callAbort = new AbortController();
7254
+ const onParentAbort = () => callAbort.abort();
7255
+ if (abortController.signal.aborted) callAbort.abort();
7256
+ else abortController.signal.addEventListener("abort", onParentAbort, { once: true });
7257
+ const callTimer = setTimeout(() => callAbort.abort(), callTimeout);
7258
+ let response;
7259
+ try {
7260
+ response = await client.messages.create(
7261
+ {
7262
+ model: MODEL_TRIAGE,
7263
+ max_tokens: 2048,
7264
+ // Haiku 5.5 rejects non-default sampling params with HTTP 400
7265
+ // ("temperature is deprecated for this model"). Omit temperature /
7266
+ // top_p / top_k entirely — do NOT send MODEL_TEMPERATURE (0).
7267
+ // Adaptive thinking is on by default for 5.5; disable it here: this
7268
+ // is binary FP classification, not open-ended analysis, and thinking
7269
+ // burns the shared AI budget (Isobar rescan: every call 400'd on
7270
+ // temperature, then timed_out with aiReviewed:false → grade D).
7271
+ thinking: { type: "disabled" },
7272
+ system: REVIEW_SYSTEM_PROMPT,
7273
+ messages: [{ role: "user", content: prompt }]
7274
+ },
7275
+ { timeout: callTimeout, signal: callAbort.signal }
7276
+ );
7277
+ } finally {
7278
+ clearTimeout(callTimer);
7279
+ abortController.signal.removeEventListener("abort", onParentAbort);
7280
+ }
6210
7281
  const text = response.content.filter((b) => b.type === "text").map((b) => b.text).join("");
6211
7282
  const results = parseReviewResponse(text);
6212
- if (!results) throw new Error("AI review returned malformed JSON");
7283
+ if (!results) {
7284
+ badOutput = true;
7285
+ throw new Error("AI review returned malformed JSON");
7286
+ }
6213
7287
  for (const r of results) {
6214
7288
  if (r.index >= batch.length) continue;
6215
7289
  const target = targets[r.index];
6216
7290
  reviewedIndices.add(target.originalIndex);
6217
7291
  if (r.verdict !== "fp") continue;
6218
- const reason = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
7292
+ const reason2 = truncateChars(applySecretMasks(r.reason, secrets), MAX_FIELD_CHARS);
6219
7293
  if (isProtectedFromAiRemoval(target.finding)) {
6220
- policyRetainedMap.set(target.originalIndex, reason);
7294
+ policyRetainedMap.set(target.originalIndex, reason2);
6221
7295
  } else {
6222
- fpMap.set(target.originalIndex, reason);
7296
+ fpMap.set(target.originalIndex, reason2);
6223
7297
  }
6224
7298
  }
6225
7299
  if (results.filter((result) => result.index < batch.length).length < batch.length) {
@@ -6227,21 +7301,35 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6227
7301
  if (!firstError) firstError = new Error("AI review returned incomplete verdicts");
6228
7302
  }
6229
7303
  } catch (err) {
6230
- const callTimedOut = isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted;
7304
+ const status2 = errorHttpStatus(err);
7305
+ if (status2 === 401 || status2 === 403) {
7306
+ authFailed = true;
7307
+ failedBatches++;
7308
+ if (!firstError) {
7309
+ firstError = err;
7310
+ firstErrorStatus = status2;
7311
+ }
7312
+ console.error(`[ai-fp-filter] AI review failed: auth status ${status2}`);
7313
+ return;
7314
+ }
7315
+ const callTimedOut = isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted || callWasAborted(err);
6231
7316
  if (callTimedOut) {
6232
7317
  timedOutCount += batch.length;
6233
7318
  budgetExpired = true;
6234
7319
  return;
6235
7320
  }
6236
7321
  failedBatches++;
6237
- if (!firstError) firstError = err;
7322
+ if (!firstError) {
7323
+ firstError = err;
7324
+ firstErrorStatus = status2;
7325
+ }
6238
7326
  }
6239
7327
  };
6240
7328
  try {
6241
7329
  let next = 0;
6242
7330
  const workerCount = Math.min(MAX_CONCURRENT, tasks.length);
6243
7331
  const workers = Array.from({ length: workerCount }, async () => {
6244
- while (next < tasks.length) {
7332
+ while (next < tasks.length && !authFailed) {
6245
7333
  const cur = next++;
6246
7334
  await reviewBatch(tasks[cur]);
6247
7335
  }
@@ -6259,28 +7347,70 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6259
7347
  `[ai-fp-filter] budget expired or model call timed out \u2014 ${timedOutCount} finding(s) not reviewed; returning them unchanged`
6260
7348
  );
6261
7349
  }
6262
- if (firstError) {
6263
- const msg = firstError instanceof Error ? firstError.message : String(firstError);
7350
+ if (firstError && !authFailed) {
7351
+ const statusLabel = firstErrorStatus == null ? "none" : String(firstErrorStatus);
6264
7352
  if (!reviewedAny) {
6265
7353
  console.error(
6266
- "[ai-fp-filter] AI review unavailable \u2014 every model call failed; returning unreviewed findings:",
6267
- msg
7354
+ `[ai-fp-filter] AI review unavailable \u2014 every model call failed; status ${statusLabel}`
6268
7355
  );
6269
7356
  } else {
6270
7357
  console.warn(
6271
- `[ai-fp-filter] partial AI review \u2014 ${failedBatches} of ${tasks.length} batch(es) failed; those findings were not reviewed:`,
6272
- msg
7358
+ `[ai-fp-filter] partial AI review \u2014 ${failedBatches} of ${tasks.length} batch(es) failed; status ${statusLabel}`
6273
7359
  );
6274
7360
  }
6275
7361
  }
6276
7362
  const filtered = findings.filter((_, index) => !fpMap.has(index));
6277
7363
  const filteredFindings = [];
6278
- for (const [index, reason] of [...fpMap].sort((a, b) => a[0] - b[0])) {
6279
- filteredFindings.push({ finding: findings[index], reason });
7364
+ for (const [index, reason2] of [...fpMap].sort((a, b) => a[0] - b[0])) {
7365
+ filteredFindings.push({ finding: findings[index], reason: reason2 });
6280
7366
  }
6281
7367
  const policyRetainedFindings = [];
6282
- for (const [index, reason] of [...policyRetainedMap].sort((a, b) => a[0] - b[0])) {
6283
- policyRetainedFindings.push({ finding: findings[index], reason });
7368
+ for (const [index, reason2] of [...policyRetainedMap].sort((a, b) => a[0] - b[0])) {
7369
+ policyRetainedFindings.push({ finding: findings[index], reason: reason2 });
7370
+ }
7371
+ const cappedCount = overflow.length;
7372
+ const eligible = totalBefore - cappedCount;
7373
+ let reason = null;
7374
+ let status = "reviewed";
7375
+ let modelStatus = null;
7376
+ if (authFailed) {
7377
+ status = "failed";
7378
+ reason = "auth_failed";
7379
+ } else if (reviewedCount === 0 && (timedOut || budgetExpired && tasks.length > 0)) {
7380
+ status = "failed";
7381
+ reason = "budget_timeout";
7382
+ } else if (reviewedCount === 0 && badOutput) {
7383
+ status = "failed";
7384
+ reason = "model_bad_output";
7385
+ } else if (reviewedCount === 0 && firstErrorStatus != null) {
7386
+ status = "failed";
7387
+ reason = "model_error";
7388
+ modelStatus = firstErrorStatus;
7389
+ } else if (reviewedCount === 0 && firstError) {
7390
+ status = "failed";
7391
+ reason = "exception";
7392
+ } else if (reviewedCount === eligible && cappedCount > 0 && missingContentCount === 0) {
7393
+ status = "partial";
7394
+ reason = "capped";
7395
+ } else if (reviewedCount === eligible && missingContentCount === 0 && !firstError && !timedOut) {
7396
+ status = "reviewed";
7397
+ reason = null;
7398
+ } else if (timedOut) {
7399
+ status = reviewedCount === 0 ? "failed" : "partial";
7400
+ reason = "budget_timeout";
7401
+ } else if (missingContentCount > 0 && !firstError && !badOutput) {
7402
+ status = reviewedCount === 0 ? "partial" : "partial";
7403
+ reason = "missing_content";
7404
+ } else if (badOutput) {
7405
+ status = reviewedCount === 0 ? "failed" : "partial";
7406
+ reason = "model_bad_output";
7407
+ } else if (firstErrorStatus != null) {
7408
+ status = "partial";
7409
+ reason = "model_error";
7410
+ modelStatus = firstErrorStatus;
7411
+ } else if (firstError || reviewedCount < eligible) {
7412
+ status = reviewedCount === 0 ? "failed" : "partial";
7413
+ reason = "exception";
6284
7414
  }
6285
7415
  return {
6286
7416
  findings: filtered,
@@ -6292,10 +7422,20 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
6292
7422
  totalBefore,
6293
7423
  reviewedCount,
6294
7424
  unreviewedCount,
6295
- cappedCount: overflow.length,
7425
+ cappedCount,
6296
7426
  missingContentCount,
6297
7427
  timedOut,
6298
- maskStats
7428
+ maskStats,
7429
+ aiDegraded: toAiDegraded({
7430
+ status,
7431
+ reason,
7432
+ surface,
7433
+ total: totalBefore,
7434
+ reviewed: reviewedCount,
7435
+ unreviewed: totalBefore - reviewedCount - cappedCount,
7436
+ capped: cappedCount,
7437
+ modelStatus
7438
+ })
6299
7439
  };
6300
7440
  }
6301
7441
 
@@ -10937,35 +12077,61 @@ function scanQuality(input, rules = qualityRules) {
10937
12077
  return findings;
10938
12078
  }
10939
12079
  export {
12080
+ AI_REASONS,
12081
+ AI_STATUSES,
12082
+ AI_SURFACES,
12083
+ BILLING_WEBHOOK_UNMATCHED_KEYS,
10940
12084
  CHECKABLE_CLAIMS,
10941
12085
  DOTENV_ASSIGN_RE,
10942
12086
  FREE_RULE_COUNT,
10943
12087
  GRADE_FINDINGS_PER_RULE,
10944
12088
  INTENT_EXPECTATIONS,
12089
+ MAX_IGNORE_BYTES,
12090
+ MAX_IGNORE_LINES,
12091
+ MAX_SUPPRESSED_LIST,
12092
+ MAX_WARNING_CAP,
10945
12093
  MODEL_ANALYSIS,
10946
12094
  MODEL_POLICY_REVIEWED,
10947
12095
  MODEL_REVIEW_INTERVAL_DAYS,
10948
12096
  MODEL_TEMPERATURE,
10949
12097
  MODEL_TRIAGE,
12098
+ NESTED_IGNORE_WARNING,
10950
12099
  NON_APP_PATH_PATTERNS,
12100
+ PLAN_CAUSES,
12101
+ PLAN_UNVERIFIED_NOTICE,
10951
12102
  PRO_RULE_COUNT,
10952
12103
  PUBLIC_ENV_PREFIX_RE,
10953
12104
  QUALITY_EXAMPLES,
12105
+ RULE_ID_PATTERN,
10954
12106
  RULE_IMPACTS,
10955
12107
  SCANNER_VERSION,
12108
+ SCAN_AI_DEGRADED_KEYS,
12109
+ SCAN_TOKEN_NULL_KEYS,
10956
12110
  SERVER_ACTION_WRITE_RE,
12111
+ SUPPRESSION_REGEXES,
10957
12112
  TEST_FILE_PATTERN,
10958
12113
  TOTAL_RULE_COUNT,
12114
+ WEBHOOK_EVENT_TYPES,
12115
+ WEBHOOK_REASONS,
12116
+ aiStatusLine,
10959
12117
  allRules,
12118
+ applySuppressions,
10960
12119
  assessHeaders,
10961
12120
  astMatch,
12121
+ attachInlineSuppressed,
12122
+ attachScanSuppression,
12123
+ billingWebhookUnmatchedProps,
12124
+ bucketFiles,
12125
+ buildMarkerIndex,
10962
12126
  buildProjectContext,
10963
12127
  buildQualityContext,
10964
12128
  buildReviewPrompt,
10965
12129
  buildTaintMap,
10966
12130
  calculateGrade,
10967
12131
  callSpreads,
12132
+ capWarnings,
10968
12133
  checkIntent,
12134
+ clampCount,
10969
12135
  classifyExposure,
10970
12136
  classifyPublicEnvVar,
10971
12137
  classifyStatement,
@@ -10973,6 +12139,7 @@ export {
10973
12139
  complianceMap,
10974
12140
  consoleLogProduction,
10975
12141
  corsWildcard,
12142
+ countPass,
10976
12143
  dangerousInnerHTML,
10977
12144
  deduplicateFindings,
10978
12145
  detectBuilder,
@@ -11017,19 +12184,26 @@ export {
11017
12184
  isMethodCall,
11018
12185
  isPrivateAddress,
11019
12186
  isProtectedFromAiRemoval,
12187
+ isRootIgnorePath,
12188
+ isRuleScopedIgnoreLine,
11020
12189
  isSbomPath,
11021
12190
  isServerSideFile,
11022
12191
  isServerTarget,
11023
12192
  isTestFile,
11024
12193
  isTestPath,
11025
12194
  isUngradedFinding,
12195
+ isUnscopedOverBroadLine,
11026
12196
  isVendoredFinding,
11027
12197
  isVendoredPath,
12198
+ isWellFormedRuleId,
11028
12199
  lineNumberAt,
11029
12200
  lineTextAt,
12201
+ markerCoversLine,
11030
12202
  maskComments,
11031
12203
  maskOutboundAuthNoise,
11032
12204
  maskSecretValue,
12205
+ maskStringLiterals,
12206
+ matchIgnore,
11033
12207
  missingAuthMiddleware,
11034
12208
  missingCSP,
11035
12209
  missingErrorBoundary,
@@ -11041,29 +12215,44 @@ export {
11041
12215
  normalizeScanPath,
11042
12216
  packReviewBatches,
11043
12217
  parseFile,
12218
+ parseIgnoreFile,
12219
+ parseIgnoreSources,
12220
+ parseMarkers,
11044
12221
  parseScanTarget,
11045
12222
  parseSupabaseConfig,
12223
+ perCallTimeoutMs,
12224
+ planCause,
12225
+ publicSuppressedRecord,
11046
12226
  qualityRules,
12227
+ readInlineSuppressed,
12228
+ readScanSuppression,
11047
12229
  replaceBlockComments,
11048
12230
  routeForFile,
11049
12231
  runCustomRules,
12232
+ scanAiDegradedProps,
11050
12233
  scanConfigs,
11051
12234
  scanDependencies,
11052
12235
  scanEntropy,
11053
12236
  scanMultiFile,
11054
12237
  scanQuality,
12238
+ scanTokenNullProps,
11055
12239
  sqlInjection,
11056
12240
  stripeWebhookUnprotected,
11057
12241
  supabaseFunctionName,
11058
12242
  supabaseNoRLS,
12243
+ suppressionSummary,
12244
+ toAiDegraded,
11059
12245
  todoLeftInCode,
11060
12246
  tryParse,
12247
+ unknownAiStatus,
11061
12248
  unmeasuredQualityRules,
11062
12249
  unvalidatedRedirect,
11063
12250
  vc001TestFixtureSeverity,
11064
12251
  vendoredReason,
11065
12252
  visitBinary,
11066
12253
  visitCalls,
12254
+ warningForUpload,
12255
+ warningLine,
11067
12256
  weakHashing,
11068
12257
  xssVulnerability
11069
12258
  };