Expand description
Shared utilities for rule implementations.
This module contains helper functions and types used across multiple rules, particularly for source code analysis that needs to handle string literals correctly.
Structs§
- String
Literal State - State machine for tracking string literal boundaries across lines.
Constants§
- INPUT_
SOURCE_ PATTERNS - Input source patterns for untrusted data origins. Used by multiple injection rules.
- LOG_
SINK_ PATTERNS - Log sink patterns in MIR (desugarings of print/log macros). Used by both CleartextLoggingRule and LogInjectionRule.
Functions§
- collect_
sanitized_ matches - Collect lines that match any of the given patterns after sanitizing string literals.
- command_
rule_ should_ skip - Check if a function should be skipped for command injection rules.
- filter_
entry - Filter function for WalkDir to skip common non-source directories.
- strip_
comments - Strip comments from a line of code.
- strip_
string_ literals - Replaces string literal content with spaces while preserving line length.