import type { ASTNode, Rule, AnalysisContext } from "../../types.js"; /** * Advanced rule that detects external calls before state updates (CEI pattern violation) * * This rule uses Control Flow Graph (CFG) analysis to detect when external calls * occur before critical state updates, which violates the Check-Effects-Interactions * pattern and can lead to reentrancy vulnerabilities. * * The rule is more sophisticated than simple AST pattern matching because it: * 1. Tracks execution paths through the function * 2. Identifies the order of external calls vs state updates * 3. Considers different control flow branches * 4. Focuses on critical state variables (balances, shares, etc.) */ export declare class ExternalBeforeStateRule implements Rule { readonly id = "external-before-state"; readonly description = "External calls should not occur before critical state updates (Check-Effects-Interactions pattern)"; readonly severity: "error"; private cfgBuilder; private cfgAnalyzer; apply(ast: ASTNode, context: AnalysisContext): void; private checkFunction; /** * Fallback basic analysis when CFG construction fails */ private performBasicAnalysis; /** * Identify critical state variables that should be updated before external calls */ private identifyCriticalStateVars; /** * Generate detailed explanation for critical violations */ private generateDetailedExplanation; /** * Check if statement contains external calls (basic version) */ private containsExternalCall; /** * Check if statement contains state updates (basic version) */ private containsStateUpdate; } //# sourceMappingURL=external-before-state.d.ts.map