/** * Defensive per-file finding cap (#142). * * A single file producing more than `cap` findings is treated as a structural * failure rather than a legitimate detection burst. When triggered, this * helper drops the original findings array and returns a single * `saturated-file` advisory carrying the suppressed count, so the signal * stays visible without flooding downstream consumers (text reports, SARIF * exporters, the cross-file phase, etc.). * * Browser-safe: pure data transformation, no Node-only APIs. The logger DI * is injected by the caller (see `src/utils/logger.ts`). * * Rationale & background: * - #142 originally proposed a 3-tier scheme (normal / advisory / suppress) * anchored to the (source, sink) coalescing schema in #143. #143 was * closed in 3.92.0 as unjustified by empirical capture (jedis / jib / * eureka cross-file: 0 multi-label coords; OWASP Benchmark per-file: * 31 % multi-rule overlap but 0 HIGH-severity multi-rule locations), so * the cap reverts to its original "defensive tripwire" shape: a single * hard threshold with no middle "downgrade to advisory" tier. * - The default of 1000 sits well above the realistic per-file ceiling * (~200 findings on jedis-shape facades) and below the structural-failure * floor observed on langchain4j during the #141 investigation * (~10K findings on a single file before the cross-file hang). */ import type { SastFinding } from '../types/index.js'; /** * Default per-file finding cap. Applied when `AnalyzerOptions.perFileFindingCap` * is omitted; `0` disables the cap entirely. */ export declare const DEFAULT_PER_FILE_FINDING_CAP = 1000; /** * Rule id and pass name used by the synthetic advisory emitted when the cap * fires. Kept in one place so downstream consumers (CLI text formatter, * SARIF exporter, dashboards) can match on a stable identifier. */ export declare const SATURATED_FILE_RULE_ID = "saturated-file"; /** * Apply the per-file finding cap. * * If `findings.length > cap` (and `cap > 0`), returns a single * `saturated-file` advisory with `evidence.suppressed_count` recording the * dropped count and `evidence.cap` recording the threshold that fired. * Otherwise returns the original array unchanged. * * @param filePath Source file path for the synthetic advisory. * @param findings Findings produced by the per-file analysis pipeline. * @param cap Threshold; `0` (or negative) disables the cap. */ export declare function applyPerFileFindingCap(filePath: string, findings: SastFinding[], cap: number): SastFinding[]; //# sourceMappingURL=per-file-finding-cap.d.ts.map