xploitscan-shared-rules 2.4.21 → 2.4.23

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.21";
2
+ var SCANNER_VERSION = "2.4.23";
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";
@@ -628,8 +1394,9 @@ function baseName(normalized) {
628
1394
  function isTestPath(filePath) {
629
1395
  const normalized = normalize(filePath);
630
1396
  if (!normalized) return false;
1397
+ if (normalized.split("/").includes("..")) return false;
631
1398
  const base = baseName(normalized);
632
- if (/(?:\.test\.|\.spec\.|\.stories\.|\.story\.|\.mock\.|\.cy\.|\.e2e\.)/i.test(base)) return true;
1399
+ if (/(?:\.test\.|\.spec\.|\.mock\.|\.cy\.|\.e2e\.)/i.test(base)) return true;
633
1400
  if (/^test_.*\.py$/i.test(base) || /_test\.py$/i.test(base)) return true;
634
1401
  if (/^Test[A-Z_]\w*\.py$/.test(base)) return true;
635
1402
  if (/^conftest\.py$/i.test(base)) return true;
@@ -637,10 +1404,11 @@ function isTestPath(filePath) {
637
1404
  if (/^[A-Z][A-Za-z0-9]*Tests\.cs$/.test(base)) return true;
638
1405
  if (/(?:^|\/)routes\/test\//i.test(normalized)) return false;
639
1406
  if (/(?:^|\/)(?:tests|testdata|spec|__tests__|__mocks__|fixtures?|mocks?)(?:\/|$)/i.test(normalized)) return true;
1407
+ if (/(?:^|\/)e2e(?:\/|$)/i.test(normalized)) return true;
640
1408
  if (/(?:^|\/)test\//i.test(normalized)) return true;
641
1409
  if (/(?:^|\/)[^/]*\.(?:UnitTests|IntegrationTests|Tests)\//i.test(normalized)) return true;
642
1410
  if (/\.cs$/.test(base) && /(?:^|\/)[^/]*Tests\//.test(normalized)) return true;
643
- if (/test-utils/i.test(normalized)) return true;
1411
+ if (/(?:^|\/)test-utils(?:\/|$)/i.test(normalized)) return true;
644
1412
  if (/(?:^|\/)testing(?:\/|$)/i.test(normalized)) return true;
645
1413
  return false;
646
1414
  }
@@ -707,10 +1475,14 @@ function isUngradedFinding(finding, options = {}) {
707
1475
  if (options.gradeVendored) return false;
708
1476
  return isVendoredFinding(finding);
709
1477
  }
710
- function vc001TestFixtureSeverity(rule, testFile, severity) {
711
- if (rule === "VC001" && testFile === true) return "low";
1478
+ var KEEP_SEVERITY_IN_TESTS = /* @__PURE__ */ new Set(["VC002", "VC014"]);
1479
+ function applyTestPathSeverity(rule, testFile, severity) {
1480
+ if (testFile === true && !KEEP_SEVERITY_IN_TESTS.has(rule ?? "")) return "low";
712
1481
  return severity;
713
1482
  }
1483
+ function testPathHold(finding) {
1484
+ return isTestPath(finding.file ?? "") && !isLive(finding) && !KEEP_SEVERITY_IN_TESTS.has(finding.rule ?? "");
1485
+ }
714
1486
 
715
1487
  // src/routes.ts
716
1488
  var API_RE = /^\/api(\/|$)|^\/_|\.(json|js|xml|txt|ico)$/;
@@ -1873,18 +2645,8 @@ function isInsideFixMessage(content, matchIndex) {
1873
2645
  const lineText = lineTextAt(content, matchIndex);
1874
2646
  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
2647
  }
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
- });
2648
+ function filterSilenced(matches, _content, _ruleId) {
2649
+ return matches;
1888
2650
  }
1889
2651
  function lineStartOffsets(content) {
1890
2652
  const starts = [0];
@@ -2584,7 +3346,8 @@ var hardcodedSecrets = {
2584
3346
  continue;
2585
3347
  }
2586
3348
  const matched = matchedText[ri] ?? "";
2587
- emit(rm, judged, textHasLiveCredential(matched) || matchedLive ? { live: true } : {});
3349
+ const pemHeader = pi === 9 && isTestPath(filePath);
3350
+ emit(rm, judged, pemHeader || textHasLiveCredential(matched) || matchedLive ? { live: true } : {});
2588
3351
  }
2589
3352
  }
2590
3353
  collectSupabaseCreateClientKeys(content, filePath, matches, hardcodedSecrets, fixMessages[3]);
@@ -3934,7 +4697,6 @@ var unvalidatedRedirect = {
3934
4697
  let m;
3935
4698
  let commentLineStart = -1;
3936
4699
  let commentLine = false;
3937
- let silenceLines;
3938
4700
  while ((m = navPattern.exec(content)) !== null) {
3939
4701
  const navLineStart = content.lastIndexOf("\n", m.index - 1) + 1;
3940
4702
  if (navLineStart !== commentLineStart) {
@@ -3947,7 +4709,6 @@ var unvalidatedRedirect = {
3947
4709
  const isPureLiteral = /^["'`][^"'`]*["'`]$/.test(value);
3948
4710
  if (!hasInterpolation && isPureLiteral) continue;
3949
4711
  const line = lineNumberAt(content, m.index);
3950
- if (isLineSilenced(silenceLines ??= content.split("\n"), line - 1, "VC016")) continue;
3951
4712
  matches.push({
3952
4713
  rule: "VC016",
3953
4714
  title: unvalidatedRedirect.title,
@@ -5042,7 +5803,7 @@ var todoLeftInCode = {
5042
5803
  category: "Code Quality",
5043
5804
  description: "TODO, FIXME, HACK, and XXX comments indicate unfinished work that should be resolved before shipping to production.",
5044
5805
  check(content, filePath) {
5045
- if (filePath.match(/test|spec|mock|__tests__|fixture|node_modules/i)) return [];
5806
+ if (isTestFile(filePath) || filePath.includes("node_modules")) return [];
5046
5807
  if (/\.(?:md|mdx|markdown|txt)$/i.test(filePath)) return [];
5047
5808
  const marker = /(?<![`'":])(?:\/\/|\/\*\*?|^[ \t]*\*+)[ \t]*(?:(?:TODO|FIXME|HACK)\b|XXX(?![\w.-])|(?:[Tt]odo|[Ff]ixme)[ \t]*:|@todo\b)/gm;
5048
5809
  const matches = [];
@@ -5084,7 +5845,7 @@ var emptyCatchBlock = {
5084
5845
  category: "Code Quality",
5085
5846
  description: "Empty catch blocks silently swallow errors, making bugs impossible to diagnose. At minimum, log the error.",
5086
5847
  check(content, filePath) {
5087
- if (filePath.match(/test|spec|mock/i)) return [];
5848
+ if (isTestFile(filePath)) return [];
5088
5849
  const fix = () => "Handle errors in catch blocks: catch(err) { console.error('Operation failed:', err); } or re-throw if appropriate.";
5089
5850
  const blocks = findMatches(content, /catch\s*(?:\([^)]{0,200}\))?\s*\{\s*\}/g, emptyCatchBlock, filePath, fix);
5090
5851
  const seen = new Set(blocks.map((m) => m.line));
@@ -5176,32 +5937,33 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5176
5937
  const sbomFile = isSbomPath(filePath);
5177
5938
  const vendoredFile = isVendoredPath(filePath);
5178
5939
  const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
5179
- const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
5180
5940
  for (const rule of ruleset) {
5181
5941
  if (disabledRules.includes(rule.id)) continue;
5182
5942
  if (sbomFile && rule.category !== "Secrets") continue;
5183
5943
  const matches = rule.check(content, filePath, project);
5184
5944
  const compliance = complianceMap[rule.id];
5185
5945
  const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
5186
- const onTestPath = isTestPath(filePath);
5187
5946
  for (const match of matches) {
5188
- if (silenceableLines && isLineSilenced(silenceableLines, match.line - 1, match.rule)) {
5189
- continue;
5190
- }
5191
5947
  const live = isLive({
5192
5948
  rule: match.rule,
5193
5949
  category: match.category,
5194
5950
  live: match.live,
5195
5951
  snippet: match.snippet
5196
5952
  });
5197
- const testFixture = onTestPath && !live;
5953
+ const testFixture = testPathHold({
5954
+ rule: match.rule,
5955
+ file: filePath,
5956
+ live: match.live,
5957
+ category: match.category,
5958
+ snippet: match.snippet
5959
+ });
5198
5960
  findings.push({
5199
5961
  ...vendored ? { vendored: true } : {},
5200
5962
  ...testFixture ? { testFile: true } : {},
5201
5963
  ...live ? { live: true } : {},
5202
5964
  id: `${match.rule}-${match.file}:${match.line}`,
5203
5965
  rule: match.rule,
5204
- severity: vc001TestFixtureSeverity(match.rule, testFixture ? true : void 0, match.severity),
5966
+ severity: applyTestPathSeverity(match.rule, testFixture ? true : void 0, match.severity),
5205
5967
  title: match.title,
5206
5968
  description: rule.description,
5207
5969
  file: match.file,
@@ -5216,7 +5978,10 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5216
5978
  });
5217
5979
  }
5218
5980
  }
5219
- return deduplicateFindings(findings);
5981
+ const deduped = deduplicateFindings(findings);
5982
+ if (!/-OK\b/i.test(content)) return deduped;
5983
+ const applied = applySuppressions(deduped, { filesByPath: { [filePath]: content } });
5984
+ return attachInlineSuppressed(applied.kept, applied.suppressed);
5220
5985
  }
5221
5986
 
5222
5987
  // src/rule-counts.ts
@@ -5683,6 +6448,7 @@ function entropySecretValues(filePath, content) {
5683
6448
  }
5684
6449
  function scanEntropyFiles(files, collect) {
5685
6450
  const findings = [];
6451
+ const inlineDropped = [];
5686
6452
  for (const { path: filePath, content } of files) {
5687
6453
  if (SKIP_FILES.test(filePath)) continue;
5688
6454
  if (SKIP_FILENAMES.test(filePath)) continue;
@@ -5696,6 +6462,8 @@ function scanEntropyFiles(files, collect) {
5696
6462
  const vendored = isVendoredPath(filePath);
5697
6463
  const dotenv = isDotenvPath(filePath) && !DOTENV_EXAMPLE_RE.test(filePath);
5698
6464
  const lines = content.split("\n");
6465
+ const folded = content.toLowerCase();
6466
+ const markerIndex = folded.includes("-ok") || folded.includes("-0k") ? buildMarkerIndex(lines, filePath) : null;
5699
6467
  let verificationDepth = -1;
5700
6468
  let braceDepth = 0;
5701
6469
  for (let i = 0; i < lines.length; i++) {
@@ -5794,7 +6562,6 @@ function scanEntropyFiles(files, collect) {
5794
6562
  }
5795
6563
  let safeWords;
5796
6564
  let verificationMeta;
5797
- let silenced;
5798
6565
  let snippet;
5799
6566
  const seenValues = /* @__PURE__ */ new Set();
5800
6567
  for (const { value, beforeAssign, dotenvName, variableName, contextFrom, contextTo } of candidates) {
@@ -5838,8 +6605,21 @@ function scanEntropyFiles(files, collect) {
5838
6605
  if (dotenvName && /(?:^|_)IDS?$/i.test(dotenvName) && !isSecretVariableName(dotenvName)) continue;
5839
6606
  const isLikelySecret = isSecretVariableName(varName) || publicEnv?.secret === true;
5840
6607
  if (entropy < 4.5 && !isLikelySecret) continue;
5841
- if (silenced === void 0) silenced = isLineSilenced(lines, i, "ENTROPY");
5842
- if (silenced) continue;
6608
+ if (markerIndex?.covers(i, "ENTROPY")) {
6609
+ inlineDropped.push({
6610
+ id: `ENTROPY-${filePath}:${i + 1}`,
6611
+ rule: "ENTROPY",
6612
+ severity: "high",
6613
+ title: "High-Entropy String Detected (Possible Secret)",
6614
+ description: "",
6615
+ file: filePath,
6616
+ line: i + 1,
6617
+ snippet: "",
6618
+ category: "Secrets",
6619
+ source: "custom"
6620
+ });
6621
+ continue;
6622
+ }
5843
6623
  collect?.push(value);
5844
6624
  const masked = maskSecretValue(value);
5845
6625
  if (snippet === void 0) snippet = getSnippet2(lines, i + 1);
@@ -5865,7 +6645,7 @@ function scanEntropyFiles(files, collect) {
5865
6645
  }
5866
6646
  }
5867
6647
  }
5868
- return findings;
6648
+ return attachInlineSuppressed(findings, inlineDropped);
5869
6649
  }
5870
6650
 
5871
6651
  // src/ai-status-constants.ts
@@ -5939,7 +6719,7 @@ var FAIL_REASONS = /* @__PURE__ */ new Set([
5939
6719
  "exception",
5940
6720
  "client_init"
5941
6721
  ]);
5942
- function clampCount(raw) {
6722
+ function clampCount2(raw) {
5943
6723
  if (typeof raw !== "number" || !Number.isFinite(raw) || raw < 0) return 0;
5944
6724
  return Math.min(Math.trunc(raw), 1e6);
5945
6725
  }
@@ -5989,9 +6769,9 @@ function planCause(specific) {
5989
6769
  }
5990
6770
  }
5991
6771
  function toAiDegraded(input = {}) {
5992
- const total = clampCount(input.total);
5993
- let reviewed = clampCount(input.reviewed);
5994
- let capped = clampCount(input.capped);
6772
+ const total = clampCount2(input.total);
6773
+ let reviewed = clampCount2(input.reviewed);
6774
+ let capped = clampCount2(input.capped);
5995
6775
  if (reviewed > total) reviewed = total;
5996
6776
  if (reviewed + capped > total) capped = total - reviewed;
5997
6777
  const unreviewed = total - reviewed - capped;
@@ -11318,39 +12098,54 @@ export {
11318
12098
  FREE_RULE_COUNT,
11319
12099
  GRADE_FINDINGS_PER_RULE,
11320
12100
  INTENT_EXPECTATIONS,
12101
+ KEEP_SEVERITY_IN_TESTS,
12102
+ MAX_IGNORE_BYTES,
12103
+ MAX_IGNORE_LINES,
12104
+ MAX_SUPPRESSED_LIST,
12105
+ MAX_WARNING_CAP,
11321
12106
  MODEL_ANALYSIS,
11322
12107
  MODEL_POLICY_REVIEWED,
11323
12108
  MODEL_REVIEW_INTERVAL_DAYS,
11324
12109
  MODEL_TEMPERATURE,
11325
12110
  MODEL_TRIAGE,
12111
+ NESTED_IGNORE_WARNING,
11326
12112
  NON_APP_PATH_PATTERNS,
11327
12113
  PLAN_CAUSES,
11328
12114
  PLAN_UNVERIFIED_NOTICE,
11329
12115
  PRO_RULE_COUNT,
11330
12116
  PUBLIC_ENV_PREFIX_RE,
11331
12117
  QUALITY_EXAMPLES,
12118
+ RULE_ID_PATTERN,
11332
12119
  RULE_IMPACTS,
11333
12120
  SCANNER_VERSION,
11334
12121
  SCAN_AI_DEGRADED_KEYS,
11335
12122
  SCAN_TOKEN_NULL_KEYS,
11336
12123
  SERVER_ACTION_WRITE_RE,
12124
+ SUPPRESSION_REGEXES,
11337
12125
  TEST_FILE_PATTERN,
11338
12126
  TOTAL_RULE_COUNT,
11339
12127
  WEBHOOK_EVENT_TYPES,
11340
12128
  WEBHOOK_REASONS,
11341
12129
  aiStatusLine,
11342
12130
  allRules,
12131
+ applySuppressions,
12132
+ applyTestPathSeverity,
11343
12133
  assessHeaders,
11344
12134
  astMatch,
12135
+ attachInlineSuppressed,
12136
+ attachScanSuppression,
11345
12137
  billingWebhookUnmatchedProps,
11346
12138
  bucketFiles,
12139
+ buildMarkerIndex,
11347
12140
  buildProjectContext,
11348
12141
  buildQualityContext,
11349
12142
  buildReviewPrompt,
11350
12143
  buildTaintMap,
11351
12144
  calculateGrade,
11352
12145
  callSpreads,
12146
+ capWarnings,
11353
12147
  checkIntent,
12148
+ clampCount,
11354
12149
  classifyExposure,
11355
12150
  classifyPublicEnvVar,
11356
12151
  classifyStatement,
@@ -11358,6 +12153,7 @@ export {
11358
12153
  complianceMap,
11359
12154
  consoleLogProduction,
11360
12155
  corsWildcard,
12156
+ countPass,
11361
12157
  dangerousInnerHTML,
11362
12158
  deduplicateFindings,
11363
12159
  detectBuilder,
@@ -11402,19 +12198,26 @@ export {
11402
12198
  isMethodCall,
11403
12199
  isPrivateAddress,
11404
12200
  isProtectedFromAiRemoval,
12201
+ isRootIgnorePath,
12202
+ isRuleScopedIgnoreLine,
11405
12203
  isSbomPath,
11406
12204
  isServerSideFile,
11407
12205
  isServerTarget,
11408
12206
  isTestFile,
11409
12207
  isTestPath,
11410
12208
  isUngradedFinding,
12209
+ isUnscopedOverBroadLine,
11411
12210
  isVendoredFinding,
11412
12211
  isVendoredPath,
12212
+ isWellFormedRuleId,
11413
12213
  lineNumberAt,
11414
12214
  lineTextAt,
12215
+ markerCoversLine,
11415
12216
  maskComments,
11416
12217
  maskOutboundAuthNoise,
11417
12218
  maskSecretValue,
12219
+ maskStringLiterals,
12220
+ matchIgnore,
11418
12221
  missingAuthMiddleware,
11419
12222
  missingCSP,
11420
12223
  missingErrorBoundary,
@@ -11426,11 +12229,17 @@ export {
11426
12229
  normalizeScanPath,
11427
12230
  packReviewBatches,
11428
12231
  parseFile,
12232
+ parseIgnoreFile,
12233
+ parseIgnoreSources,
12234
+ parseMarkers,
11429
12235
  parseScanTarget,
11430
12236
  parseSupabaseConfig,
11431
12237
  perCallTimeoutMs,
11432
12238
  planCause,
12239
+ publicSuppressedRecord,
11433
12240
  qualityRules,
12241
+ readInlineSuppressed,
12242
+ readScanSuppression,
11434
12243
  replaceBlockComments,
11435
12244
  routeForFile,
11436
12245
  runCustomRules,
@@ -11445,16 +12254,19 @@ export {
11445
12254
  stripeWebhookUnprotected,
11446
12255
  supabaseFunctionName,
11447
12256
  supabaseNoRLS,
12257
+ suppressionSummary,
12258
+ testPathHold,
11448
12259
  toAiDegraded,
11449
12260
  todoLeftInCode,
11450
12261
  tryParse,
11451
12262
  unknownAiStatus,
11452
12263
  unmeasuredQualityRules,
11453
12264
  unvalidatedRedirect,
11454
- vc001TestFixtureSeverity,
11455
12265
  vendoredReason,
11456
12266
  visitBinary,
11457
12267
  visitCalls,
12268
+ warningForUpload,
12269
+ warningLine,
11458
12270
  weakHashing,
11459
12271
  xssVulnerability
11460
12272
  };