/** * Pass #28: swallowed-exception (CWE-390, category: reliability) * * Detects catch blocks that silently discard exceptions — no re-throw, * no logging call, no error return. Swallowed exceptions hide failures, * make debugging extremely difficult, and can mask security issues. * * Detection strategy: * 1. Build an ExceptionFlowGraph from the CFG exception edges. * 2. For each catch handler entry block, determine the catch body bounds * using a brace-depth walk of the source text. * 3. Scan the catch body for any "meaningful action": throw/raise, * logging API call, or a non-empty return statement. * 4. If nothing is found → emit a finding at the catch line. * * Languages: Java, JavaScript, TypeScript, Python (skip Rust/Bash). */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; export interface SwallowedExceptionResult { swallowed: Array<{ line: number; }>; } export declare class SwallowedExceptionPass implements AnalysisPass { readonly name = "swallowed-exception"; readonly category: "reliability"; run(ctx: PassContext): SwallowedExceptionResult; /** * Walks source lines starting at `startLine` counting brace depth. * Returns the line where the brace depth first returns to zero after * the opening brace (i.e., the closing brace of the catch block). * Capped at `maxLine`. */ private findCatchBodyEnd; } //# sourceMappingURL=swallowed-exception-pass.d.ts.map