/** * Pass #31: double-close (CWE-675, category: reliability) * * Detects I/O resources that are closed more than once within the same * method. Calling close() on an already-closed stream (e.g., Java's * FileInputStream, Node.js streams) typically throws an exception and * indicates a resource-management bug. * * Detection strategy: * 1. Find resource-opening calls (same patterns as resource-leak-pass). * 2. Collect the bound variable from DFG defs at the open line. * 3. Find ALL close() calls on that variable within the enclosing method. * 4. If two or more close calls exist: * a. Skip if both are inside a finally block (benign idiomatic pattern). * b. Otherwise emit a finding. * * Languages: Java, JavaScript, TypeScript, Python, Rust (skip Bash). */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; export interface DoubleCloseResult { doubleCloses: Array<{ openLine: number; closeLines: number[]; variable: string; }>; } export declare class DoubleClosePass implements AnalysisPass { readonly name = "double-close"; readonly category: "reliability"; run(ctx: PassContext): DoubleCloseResult; /** True if the given line is inside a `finally` block in the method. */ private isInFinallyBlock; } //# sourceMappingURL=double-close-pass.d.ts.map