Expand description
The pattern-safety chain: the full port of the reference’s ReDoS
defenses (guard_core/detection_engine/_redos_*).
Module map (reference -> port):
| Reference module | Port |
|---|---|
_redos_structural_prefilters.py | prefilters |
_redos_structure_primitives.py / _redos_structure_rules.py / _redos_structure.py | structure |
_redos_unreachable_terminator.py | unreachable_terminator |
_redos_literal_in_wildcard.py | literal_in_wildcard |
_redos_ambiguous_tail.py | ambiguous_tail |
_redos_intervals.py | intervals |
_redos_ignorecase_fold.py | fold |
re._parser (op tree) | ast |
_redos_parse_slots.py | parse_slots |
| category predicate scan | categories |
_redos_exact_state.py | exact_state |
_redos_class_intersection.py | class_intersection |
_redos_repeat_alphabet.py | repeat_alphabet |
_redos_repeat_prefix_state.py | repeat_prefix_state |
_redos_prefix_history.py | prefix_history |
_redos_repeat_lookbehind.py | repeat_lookbehind |
_redos_repeat_prefix.py | repeat_prefix |
_redos_repeat_units.py | repeat_units |
_redos_stray_chooser.py | stray_chooser |
_redos_reach_probe.py | reach_probe |
_redos_probe_batches.py | probe_batches |
_redos_probe_fill.py | probe_fill |
_redos_cost_arbiter.py | cost_arbiter |
the python -c child scripts | child |
compiler.validate_pattern_safety | safety |
Re-exports§
pub use safety::SafetyMode;pub use safety::SafetyReason;pub use safety::SafetyVerdict;pub use safety::StructuralRule;pub use safety::default_flags;pub use safety::validate_pattern_safety;pub use safety::validate_pattern_safety_compat;pub use safety::validate_pattern_safety_with_flags;
Modules§
- ambiguous_
tail - Ambiguous optional tail detection and atom character semantics.
- ast
- Python
re-flavor pattern parser. - categories
- Unicode category intervals for the ReDoS pattern-safety chain.
- child
- Killable probe subprocesses.
- class_
intersection - Cross-atom class-intersection probe units.
- cost_
arbiter - The empirical cost arbiter: budget ladder, host-load normalization, stride sampling, and retry-once verdicts over killable timing children.
- exact_
state - Exact-state narrowing for group crossings.
- fold
- Case-fold expansion for IGNORECASE interval computation.
- intervals
- Dense interval sets over the Unicode code-point range.
- literal_
in_ wildcard - Quantified-class literal absorption detection.
- literal_
runs - Adversarial literal run extraction.
- parse_
slots - Slot decomposition of a parsed pattern.
- prefilters
- Pattern-safety dispatcher: dangerous constructs and the five structural detectors, in the reference decision order.
- prefix_
history - History-observability and repeat containment over the op tree.
- probe_
batches - Probe-set digests, timing validation, and batch measurement.
- probe_
fill - Reach-probe candidate builders: every repeatable adversarial trigger family the chain can extract from a pattern.
- reach_
probe - Reaching probe synthesis: build a concrete string that reaches every quantified region of the pattern.
- repeat_
alphabet - Repeated-alphabet fills and large bounded repeat detection.
- repeat_
lookbehind - Negative-lookbehind handling for the prefix walk.
- repeat_
prefix - The prefix walk: consumes parsed ops from the empty state and yields the reachable prefix states, recording reaching prefixes for repeated bodies.
- repeat_
prefix_ state - Prefix-walk state machine shared by the repeat-prefix machinery.
- repeat_
units - Repeat-site (prefix, unit) extraction for group probes.
- safety
- The pattern-safety verdict API.
- stray_
chooser - Stray character selection with child-verified forcing points.
- structure
- String-level structural analysis primitives and the nested/adjacent unbounded-quantifier rules.
- timeout
- The
BuilderTimeouterror: the port of the reference’sTimeoutErrorraised by every deadline and budget guard in the probe builders. - unreachable_
terminator - Broad-scan unreachable-terminator detection.
- validation_
cache - The disk-backed cache for the pattern-safety validator’s expensive
layer: the reference
_validation_cache.py(the PHP lane’sDetection/Redos/ValidationCache.phpand the TSPatternValidationCacheport the same module).