Expand description
Detection wiring for the compiled pattern table and its dispatch.
Compiles the canonical pattern table and dispatches each pattern to the
same structural matcher, windowed finder, candidate validator and
scan-window bounds as the guard-core spec 4.0.2 reference
(guard_core/handlers/_suspatterns_regex.py).
Residual patterns (lookaround / backreference constructs the regex
crate rejects) are served by structural equivalents in matchers.rs.
Table entry id is the table position (see table.rs) and keys the
dispatch below.
Modules§
- binary
- Binary artifact density gate and binary-content heuristic, ported from
guard_core/detection_engine/binary_prefix.pyandsemantic.py(looks_like_binary_content). - chars_
util - Character helpers shared by the structural matchers. The reference walks Python strings by code point; these helpers provide the same semantics over Rust byte offsets.
- file_
upload - File-upload matchers ported from
guard_core/handlers/_suspatterns_file_upload.py(spec 4.0.2). - ldap_
ipv4 - LDAP breakout window analysis and legacy IPv4 host validation, ported
from
guard_core/handlers/_suspatterns_ldap_ipv4.py(spec 4.0.2). - matchers
- Structural matchers for pattern-table entries the
regexcrate rejects. - pickle
- Pickle opcode-stream validation ported from
guard_core/handlers/_suspatterns_pickle.py(spec 4.0.2). - pyregex
- Python
recompatibility layer for the detection pattern table. - scan_
window - Bounded scan windows ported from
guard_core/detection_engine/scan_window.py(spec 4.0.2). - shell_
validators - Candidate-rejection validators ported from
guard_core/handlers/_suspatterns_shell_validators.py(spec 4.0.2). - table
- Canonical detection pattern table for guard-core spec 4.0.2.
- templates
- Template-injection scan matchers ported from
guard_core/handlers/_suspatterns_templates.py(spec 4.0.2). - xml_xxe
- XML/XXE structural matchers ported from
guard_core/handlers/_suspatterns_xml_xxe.py(spec 4.0.2).
Structs§
- Compiled
Entry - Regex
Threat - A regex threat exactly as the reference
_build_regex_threatemits it.
Enums§
- View
Filter - Which scan view is being processed; mirrors
_pattern_excluded_from_view.
Constants§
- GATED_
PATTERN_ MAX_ SUBJECT_ BYTES SusPatterns::GATED_PATTERN_MAX_SUBJECT_BYTES(15 KiB).- LEXICON_
ENV_ PATH - LEXICON_
ETC_ PATH - Lexicon-lookahead path shapes (ids 33/102/107/110/112/115): the reference
pattern is
\A(?=LEXICON-in-first-line)\A<path-shape>; the lexicon membership becomes a guard on the compiled path shape. - LEXICON_
GIT_ PATH - LEXICON_
HTACCESS_ PATH - LEXICON_
PHPINFO_ PATH - LEXICON_
WP_ PATH
Statics§
Functions§
- decode_
budget_ exhausted_ threat - The synthetic exhaustion threat appended when a decode pass hit its 16-iteration budget.
- decoded_
view_ traversal_ threat _check_decoded_view_path_traversal: the\.\.[\\/]shape fires only when decoding revealed more traversal shapes than the raw view carries.- find_
first_ threat - First accepted regex threat for one entry (validator + recon leading-separator + noise gates).
- is_
excluded_ from_ view - resolve_
pattern_ weight - scan_
time_ budget_ exhausted_ threat - The synthetic
pattern_timeoutthreat recorded when the scan time budget is spent (reference_scan_time_budget_exhausted_threat): empty match, position 0, categorycustom, thecustomcategory weight. - scan_
view - One view pass of
_check_regex_patterns: context filter, per-pattern dispatch, validator and binary-density gates, first accepted threat each. Runs with no scan time cap. - scan_
view_ budgeted scan_viewunder a per-request scan time budget.