struct PassiveScan::Matcher

Defined in:

models/passive_scan.cr

Constant Summary

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

Constructors

Instance Method Summary

Constructor Detail

def self.new(yaml : YAML::Any) #

[View source]

Instance Method Detail

def compiled_regex : Regex | Nil #

[View source]
def compiled_regex=(compiled_regex : Regex | Nil) #

[View source]
def compiled_regexes : Array(Regex) | Nil #

[View source]
def compiled_regexes=(compiled_regexes : Array(Regex) | Nil) #

[View source]
def condition : String #

[View source]
def condition=(condition : String) #

[View source]
def dead? : Bool #

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


[View source]
def patterns : Array(YAML::Any) #

[View source]
def patterns=(patterns : Array(YAML::Any)) #

[View source]
def regex_compile_failed? : Bool #

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.


[View source]
def regex_error : String | Nil #

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.


[View source]
def 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.


[View source]
def 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.


[View source]
def type : String #

[View source]
def type=(type : String) #

[View source]
def valid? : Bool #

[View source]
def validation_errors : Array(String) #

[View source]