Skip to main content

Module file_upload

Module file_upload 

Source
Expand description

File-upload matchers ported from guard_core/handlers/_suspatterns_file_upload.py (spec 4.0.2).

All four patterns anchor on a filename = "<quoted>" token whose boundary is located by walking back over whitespace to a required boundary char. The dangerous-extension marker carries a (?![A-Za-z0-9]) guard; the guard is enforced with per-branch suffix checks in the reference’s alternation order (php\d* first with digit backtracking, then the literal branches), which reproduces the lookahead exactly.

Constants§

BENIGN_TERMINAL
Benign terminal extensions for the double-extension shape.
DANGEROUS_EXT
Dangerous extension alternation with com (terminal-extension pattern).
DOUBLE_EXT
Dangerous extension alternation for the double-extension marker (no com).

Functions§

dangerous_marker_at
Anchored-pos matcher for \.(?:php\d*|<alternation>)(?![A-Za-z0-9]).
file_upload_scan_matches
_file_upload_scan_matches: candidates from filename tokens, classified per pattern; the emitted match spans the validated [match_start, end).