struct

PassiveScan::Matcher

Inherits Struct < Value < Object

Constants

ALLOWED_CONDITIONS = {"and", "or"}
ALLOWED_TYPES = {"word", "regex"}

Constructors

new(yaml : YAML::Any)
Source

Instance methods

compiled_regex
Source
compiled_regex=(compiled_regex : Regex | Nil)
Source
compiled_regexes
Source
compiled_regexes=(compiled_regexes : Array(Regex) | Nil)
Source
condition
Source
condition=(condition : String)
Source
dead?

True when this matcher can never produce a hit: its regexes did not compile, so match_content? returns false for every input.

Source
patterns
Source
patterns=(patterns : Array(YAML::Any))
Source
regex_compile_failed?

True when this matcher's regexes failed to compile. detect.cr checks it to short-circuit instead of retrying the (already-broken) compilation on every line.

Source
regex_error

Why this matcher's regexes failed to compile, or nil when they compiled. Held as the message rather than a bare flag so the loader can name the pattern in the warning it prints — the previous shape wrote the reason straight to Crystal's global Log, whose default backend is STDOUT, so it landed in the middle of -f json / -f sarif output and broke every downstream parser.

Source
string_patterns

Pre-stringified patterns. detect.cr's hot path used to call pattern.to_s per (file × line × matcher); the conversion is the same every call so we do it once at load time.

Source
string_patterns=(string_patterns : Array(String))

Pre-stringified patterns. detect.cr's hot path used to call pattern.to_s per (file × line × matcher); the conversion is the same every call so we do it once at load time.

Source
type
Source
type=(type : String)
Source
valid?
Source
validation_errors
Source