Skip to content

v3.13.0

Choose a tag to compare

@rennf93 rennf93 released this 25 Aug 03:02
· 163 commits to master since this release
3.13.0
5031079

Detection-engine hardening: ReDoS validation backstop, scan-window mechanism, all-category ingestion bypasses, new deserialization category, and breaking auth-verifier requirement (v3.13.0)

Special thanks to @hsnyus-09 and @iam-niranjan for your GHSA reports and the support throughout. Thank you for making the Guard Core ecosystem better!

Highlights

  • Breaking: require_auth/api_key_auth now require a verifier. Supply one per route (verifier=) or globally (SecurityConfig.auth_verifier), or 401 fail-closed (GHSA-x96c-fcg2-x2f9, CWE-287).
  • Breaking: 15 dynamic-rule snapshot fields validate on assignment. auto_ban_threshold, blocked_countries, block_cloud_providers, blocked_user_agents, etc. now raise ValueError on out-of-range or wrong-type instead of silently landing in the running config.
  • ReDoS backstop ships. validate_pattern_safety runs in a killable subprocess and flags adjacent broad unbounded quantifiers, ambiguous optional tails, unreachable terminator scans, and ambiguous literal boundaries; 35 known-quadratic built-ins are rejected pending pattern rewrites. The shared executor timeout is GIL-bound and does not bound a catastrophic match; a 512-byte User-Agent cap is the real bound (GHSA-r7hm-rjvg-xx7j, also closing CVE-2025-53539 and CVE-2025-54365).
  • New scan_window mechanism. bounded_search/bounded_finditer bound the regex search window (not the match length) for PREFIX[^x]*TERMINATOR shapes, with no length cap and no N+1 bypass.
  • New deserialization category (CWE-502). Java/pickle/PHP/.NET/Ruby serialized payloads in base64 wire form.
  • All-category ingestion bypasses closed. Non-UTF-8 body scan (CWE-693, every released version), preprocessor truncation gaps, _BASE64_RE floor lowered 20 to 12, parameter names now scanned, structured-JSON operator keys, and a surrogateescape decode boundary across five sites.
  • Detection widenings. Nine categories extended past literal spellings; seven widened to new contexts (header, url_path, query_param); new nosql [$op], proto_pollution, template {{}}/#{}, sqli tautology, and cmd_injection bare $(...)/Log4Shell JNDI patterns.
  • Detection attribution behind a reverse proxy. detect_penetration_attempt and log_activity now attribute threat events and log lines to the resolved real client IP, not the proxy socket peer.
  • Telemetry hygiene. OtelHandler and LogfireHandler no longer clobber or destroy host providers; ban_ip refuses loopback and trusted-proxy targets and warns before banning a private IP that may be the proxy.

Breaking

  • require_auth and api_key_auth require a verifier. Supply one per route via verifier= or globally via SecurityConfig.auth_verifier. Without a resolvable verifier, requests are rejected with 401 (fail-closed). Previously any Bearer/Basic prefix or any API-key header value was accepted without validation (GHSA-x96c-fcg2-x2f9, CWE-287). The old header-presence/scheme-prefix behavior is no longer the default; use require_authorization_header(scheme=...) for a presence-only gate, documented as NOT authentication.
  • Post-construction assignment to 15 dynamic-rule snapshot fields now revalidates. blocked_countries, whitelist_countries, rate_limit, rate_limit_window, endpoint_rate_limits, block_cloud_providers, blocked_user_agents, enable_penetration_detection, enable_ip_banning, enable_rate_limiting, emergency_mode, emergency_whitelist, auto_ban_threshold, auto_ban_duration, enable_rate_limit_auto_ban raise ValueError on a wrong-type or out-of-range value where a bare setattr previously accepted it silently. DynamicRuleManager._apply_rules's rollback restores every already-mutated field on a later validation failure, so a push stays atomic.
  • SecurityConfig.auto_ban_threshold and auto_ban_duration now enforce ge=1. Construction with 0 or a negative value now raises; pass 1 or above.
  • block_cloud_providers accepts six providers and rejects unknown names. DigitalOcean, Linode, and Vultr join AWS/GCP/Azure. An unrecognized provider name (the part before an optional :!region suffix) now raises ValueError at construction and reassignment instead of being silently dropped. The argless @block_clouds() decorator now blocks all six providers; pass an explicit list to keep the previous three-provider scope.
  • block_cloud_providers=None stays None. Construction, assignment, model_copy, and dynamic-rule rollback/restore no longer silently drift None to frozenset(); every real consumer already gates on truthiness.

Added

  • is_ip_allowed and check_ip_access are now exported at the top level as guard_core.is_ip_allowed and guard_core.check_ip_access, for websocket and framework-agnostic callers that have only a raw IP. Async and sync mirrors updated identically.
  • check_rate_limit_by_ip(ip, config, redis_handler=None, endpoint_path="") (guard_core.check_rate_limit_by_ip): a request-free rate-limit primitive for websocket consumers. Returns True/False and records a hit per call. With the default endpoint_path="" the Redis key collapses to the HTTP pipeline's global bucket for that IP; pass a non-empty endpoint_path for an isolated budget. Feeds the auto-ban engine when enable_rate_limit_auto_ban and enable_ip_banning are both set. Async and sync mirrors updated identically.
  • SecurityConfig.enable_rate_limit_auto_ban (bool, default False): opt-in wiring that feeds rate-limit violations into the same auto-ban engine penetration detection uses; "rate_limit" is now a valid threat_ban_config key. The suspicious-count structure is in-memory, per-process, and 10k-IP FIFO-capped, so multi-replica deployments do not share auto-ban counts. Async and sync mirrors updated identically.
  • DynamicRules.auto_ban_threshold, auto_ban_duration, enable_rate_limit_auto_ban: Guard Agent dynamic-rule pushes can now tune auto-ban at runtime. Applied with the same setattr-plus-log convention as the existing enable_ip_banning toggle; all three restore on rollback.
  • DynamicRules.expires_at is honored. A dynamic rule push with a non-null expires_at auto-reverts its config mutations once that time passes. Naive (tzinfo-less) expires_at is treated as UTC. A rule whose expires_at is already past on receipt now never activates, instead of driving a revert-then-reapply loop every tick.
  • SecurityConfig.auth_verifier: global default verifier callable for require_auth and api_key_auth.
  • require_authorization_header(scheme=...): presence/scheme-prefix-only decorator, documented as NOT authentication.
  • Verifier contract: verifier(request, credential) -> Principal | None. Sync or async in async (ASGI) deployments; sync-only in WSGI. An async verifier in WSGI, or any verifier that raises, is rejected with 401 fail-closed. The authenticated principal is stored on request.state.auth_principal.
  • Dedicated Detection Gate CI workflow (.github/workflows/detection-gate.yml) runs on every PR and master push, fails on sync-tree drift, and runs both detection benchmarks as a named job whose failure message names the regressed category.
  • PatternCompiler.validate_pattern_safety hardened. New structural rules flag adjacent broad unbounded quantifiers, ambiguous optional tails in quantified groups, unreachable terminator scans, and ambiguous literal boundaries. The runtime probe runs in a killable subprocess (subprocess.run(..., timeout=2.0), never a thread the caller waits on). validate_pattern_safety accepts an optional max_content_length and probes at the caller's real cap; every SecurityConfig-aware call site passes its own cap. Numeric backreferences (\1-\9) are now resolved in the reach probe; unresolvable backreferences and unreachable regions fail closed. Sync mirror updated in lockstep.
  • _MAX_USER_AGENT_MATCH_LENGTH = 512 (guard_core/utils.py): the User-Agent header is truncated to 512 characters before any pattern runs against it, the request-body path's detection_max_content_length cap's missing counterpart. Chosen from ASP.NET's documented precedent. Sync mirror updated in lockstep.
  • guard_core.detection_engine.scan_window (bounded_search, bounded_finditer, mirrored under guard_core.sync.detection_engine.scan_window): a drop-in replacement for compiled.search(text) that bounds the regex scan window to where a match could possibly terminate, not the match length. No length cap, no N+1 bypass. Callers supply compiled, prefix, and terminator regexes built once per built-in pattern. Quote-aware (WHATWG HTML 13.2.5.34). Proven linear in a killable subprocess. Mechanism only; built-in patterns are wired in the Fixed section below.
  • New deserialization detection category (CWE-502) catches Java (rO0AB), Python pickle (gASV/gAWV plus GLOBAL-opcode text markers), PHP (O:/C:/E:), .NET BinaryFormatter (AAEAAAD) plus <ObjectDataProvider, and Ruby Marshal (BAh[Jv7bV]) serialized payloads in their base64 wire form. Raw bytes are structurally unreachable (the body decode rejects non-UTF-8), so only the base64 wire form is matched.
  • Known-mechanism disclosure: UTF-16/UTF-32 wide-encoded payloads are detected, but as an accident of null-byte removal, not a designed capability, and now pinned (tests/test_detection_engine/test_wide_encoding_detection.py). EBCDIC codepages (cp037, cp500, etc.) miss outright and are left unfixed as scoping data.
  • Committed adversarial ReDoS corpus (tests/test_sus_patterns/test_redos_backstop_corpus.py): one maximally-adversarial payload per confirmed-quadratic built-in pattern family, run through the real sus_patterns_handler.detect() production entry point. Sync mirror updated in lockstep.

Changed

  • CI enforces --cov-fail-under=100 and -W error. A coverage drop or a new warning now fails the build instead of accumulating. make lint runs ruff format --check . instead of rewriting in place; use make fix to apply formatting.
  • Built-in detection patterns no longer compile with re.MULTILINE. The global flag was the root cause behind five categories of false positives 3.12.0 fixed anchor by anchor; only three SSRF anchor usages remain, all with adjacent \s alternatives that already consume newlines. User-supplied patterns keep re.IGNORECASE | re.MULTILINE unchanged. Sync mirror updated in lockstep.
  • cmd_injection flags structure, not a ~60-name hardcoded command list. ${...} flags on POSIX bare-parameter-name grammar failure, $(...) keeps its ambiguous-context gate, quote-splice flags 3+ consecutive single-char fragments, glob-wildcard requires a preceding shell operator, brace-expansion requires start-or-operator anchoring and excludes :/quote from item grammar. ${whoami} in bare prose is intentionally undetected (parameter expansion, not execution). Per-category recall baselines lowered as a ruled reduction, not a moved goalpost. Sync mirror updated in lockstep.
  • Structural rules become pre-filters; a timed cost arbiter decides. validate_pattern_safety's default path builds every adversarial probe a battery of strategies can produce, times each at 4/8/16/32k chars using time.process_time() in a killable subprocess (minimum of 5 samples, median drives the verdict), and rejects only if the growth-extrapolated cost at the caller's real cap exceeds 50ms. A structural hit supplies the rejection reason when the arbiter also rejects and forces fail-closed rejection when no probe can be built; a structural hit measured under budget and linear no longer rejects on its own. The known-quadratic built-in constant grows from 22 to 35 entries, driven by measurement, not hand-picking. Sync mirror updated in lockstep.

Fixed

  • LDAP forward-window and backtick context-window length cliffs. Both used a fixed 40-character window; a corroborating token 40+ chars away fell outside and silently stopped detecting. Replaced with scans bounded by the construct's own natural delimiters (balanced parens, quotes, newlines) and the next candidate start. No magic number, no cliff to relocate (CVE-2025-54365). Sync mirror updated in lockstep.
  • Four {0,N}-capped patterns converted to scan-window finders. _LDAP_NULL_BYTE_ATTR_RE/_LDAP_NULL_BYTE_DECODED_ATTR_RE (value {0,255} cap was a live bypass), _QUOTE_SPLICE_CANDIDATE_RE, _GLOB_WILDCARD_ATOM_RE route through _WINDOWED_PATTERN_FINDERS in suspatterns_handler.py; the {0,N} cap is a length cliff by construction (CVE-2025-54365) and an unbounded quantifier is quadratic (CVE-2025-53539), so neither is acceptable alone. Three template cap patterns ({{...}}, ${...} SSTI) stay capped pending a corrected shared bounded_finditer that an independent fuzz found silently drops matches. Sync mirror updated in lockstep.
  • Eleven built-in PREFIX[^x]*TERMINATOR patterns route through bounded_finditer. Script, style-expression, object, embed, applet, dir-traversal ..;, file-inclusion URL, XML entity/DOCTYPE SYSTEM, CDATA, DOCTYPE-external-entity, and the SSTI #{...} shape. CPU timing linear at the 262144-byte cap. Outcome parity differential-fuzzed per pattern (20,000 trials each, zero mismatches). Sync mirror updated in lockstep.
  • 26 recon/sensitive_file/cms_probing path-probe patterns carried a released quadratic-backtracking DoS since the 723e0882 "Initial release" commit (0.1.0 and every tag since). The prefix group's own character class fully contains the mandatory literal that follows it. Fixed with a segment guard (_path_only_pattern, a negative-lookahead-disambiguation idiom). 25 of 26 now measure safe through the arbiter at the real 262144 cap. Sync mirror updated in lockstep.
  • Regex-match timeouts on the shared scan pool now report as a threat. A time.process_time()-bounded regex that never finished is unknown, not absent; _check_regex_patterns now builds a pattern_timeout threat entry when timeout_occurred is true and no real match was found. Sync mirror updated in lockstep.
  • Double validation on every dynamic-rule apply and rollback removed. _apply_user_agent_rules and DynamicRuleManager._restore_config now use SecurityConfig._set_prevalidated, which skips only the _FIELD_REVALIDATORS re-check; the general assignment path is unweakened. The _skip_revalidation flag moved off the instance to a contextvars.ContextVar after a reproduced thread race and a model_copy double-bypass. A pinned test fails if _set_prevalidated is ever made async or grows an await between set and reset. Sync mirror updated in lockstep.
  • ContentPreprocessor.truncate_safely and the preprocessor now treat detection_max_body_inspect_bytes as the single memory bound. A hardcoded 262144-byte scan window, a MAX_SHORT_BASE64_SCAN_BYTES = 2_000_000 pre-slice, and a MAX_GUNZIP_OUTPUT_BYTES = 8192 decompression cap all silently ignored a raised detection_max_body_inspect_bytes; the scan cap is now wired from the caller at both singleton and per-request sites, the pre-slice is deleted, and the gunzip output cap threads through from the knob. decode_common_encodings's 16-iteration budget now raises a synthetic custom weight-1.0 threat when content is still changing on the final iteration. max_decode_iterations raised from 7 to 16. Sync mirror updated in lockstep.
  • _BASE64_RE floor lowered from {20,} to {12,}. A payload whose encoded form falls under 20 characters was never a decode candidate; 1' OR '1'='1 (16-char blob) now detects. Measured 0 new false positives across a 2034-case benign base64-ish corpus at every threshold. Sync mirror updated in lockstep.
  • Four encoded-path-traversal evasion classes closed in ContentPreprocessor. Newline/MIME line-wrap inside a base64 blob, gzip-then-base64, overlong-UTF-8 percent-byte runs (%c0%af, %e0%80%80%af, %f0%80%80%80%af), and %uXXXX IIS-style percent-u escapes are now decoded. A Unicode-lookalike renormalization pass folds decoded separator lookalikes to literal / or \. path_traversal now compares the decoded view against the raw view and flags when decoding revealed a ..[/\\] the attacker tried to hide. A new dir_traversal pattern catches ..;/ semicolon path-parameter bypass. Sync mirror updated in lockstep.
  • SemanticAnalyzer was quadratic on plain text. Four attack_structures patterns (tag_like, function_call, path_traversal, url_pattern) had unbounded greedy quantifiers whose class did not exclude their own start characters. Bounded to finite maximums; tag_like is unbounded again but scanned only up to its last > via _tag_scan_window, the general technique for this defect class. extract_tokens no longer spins up ten ThreadPoolExecutor instances per call. Sync mirror updated in lockstep.
  • ban_ip refuses loopback and trusted-proxy targets, and warns before banning a private IP that may be the proxy. A reverse-proxy deployment with trusted_proxies unset previously banned 127.0.0.1 and locked out all traffic. Refusal is a logged warning, never an exception; no opt-out. A private non-loopback IP (10/8, 172.16/12, 192.168/16, 169.254/16, IPv6 ULA fc00::/7) not listed in trusted_proxies is still banned but logs a loud distinct warning that the IP may be a reverse proxy and the ban could block all users, so a misconfigured proxy egress is surfaced without refusing a possibly-legitimate internal ban; loopback is refused outright because it is never a real client. A Redis-down ban above the 1-hour local-cache cap now clamps to 1 hour instead of raising (previously: ValueError with fail_secure=True returned HTTP 500 for every request; fail_secure=False silently applied no protection). Sync mirror updated in lockstep.
  • detect_penetration_attempt and log_activity attribute to the real client IP behind trusted proxies, not the proxy socket peer. Both resolved the client IP from request.client_host (the connecting socket peer, e.g. 127.0.0.1) regardless of config.trusted_proxies and X-Forwarded-For, so behind a reverse proxy every threat log line and detection event was attributed to the proxy. Both now use extract_client_ip(request, config) (the same resolver the security pipeline already keys enforcement on), honoring trusted_proxies and X-Forwarded-For and falling back to the connecting IP when no config or no forward is present. Enforcement (IP banning, rate limiting, suspicious-activity counts) was already keyed off the resolved request.state.client_ip and is unchanged; only detection logging and threat-event attribution were wrong (issue #73). Sync mirror updated in lockstep.
  • OtelHandler and LogfireHandler no longer clobber or destroy providers they do not own. OtelHandler.start() claims ownership only if it won the set-once race; stop() shuts down only a provider it recorded owning. LogfireHandler.start() checks logfire.DEFAULT_LOGFIRE_INSTANCE.config._initialized before calling configure(); stop() calls logfire.shutdown() only when this instance configured. Both are idempotent in any order. A LogfireHandler.start() that failed configure() no longer gets permanently stuck refusing to retry. Sync mirror updated in lockstep.
  • scripts/unasync.py --check no longer reports a missing sync mirror as "up to date" or deletes a mirror it just generated. Check mode generates into a temporary .unasync_check_tmp_ directory and compares against the untouched real tree; a missing mirror prints MISSING: and exits non-zero, an orphan prints ORPHAN:. Pinned with a test. Sync mirror updated in lockstep.
  • BehaviorTracker Redis sink no longer interpolates endpoint_id, client_ip, or rule.pattern into a KEYS glob. All three now pass through hashlib.sha256 per segment, closing a glob-injection sink and a field-boundary collision. Counting is now RedisManager.record_sliding_window_hit (one pipelined ZADD/ZREMRANGEBYSCORE/ZCARD/EXPIRE), no keyspace-wide KEYS scan. The sorted-set member is uuid.uuid4().hex, not the timestamp, so identical-timestamp hits each count separately (a 3000-request burst previously collapsed to 166 entries). Upgrading resets every identity's in-window counter to zero; old keys self-expire within one window. Sync mirror updated in lockstep.
  • Four file_upload filename= sites carried a {0,255} cap, a live shipping bypass. A filename with a 256+ char prefix evaded detection. Caps removed; a new _file_upload_scan_window truncates each scan to the last quote character, linear per position with no length cliff. asmx, cer, phps join the dangerous-extension list. The double-extension benign-terminal whitelist drops archive extensions (zip/gz/tar/rar/7z) that false-positived on backup and release-artifact filenames. Sync mirror updated in lockstep.
  • Three xss patterns (event-handler, href/src/data/action, style=expression) were genuinely quadratic. Fixed structurally, not by capping: a single non-quantified atom between the two adjacent broad quantifiers removes the ambiguous split. The event-handler pattern is on\w+ scoped to a real tag/attribute shape (replacing an 11-name hardcoded enum), gated by a shared _HTML_TAG_OPEN_RE = r"<[A-Za-z/]" so a < used as a less-than operator no longer opens a false tag, with a 200-name event-handler allowlist derived from PortSwigger and OWASP. HTML5 whitespace around = is now tolerated (\s{0,20}) in xss and file_upload. Sync mirror updated in lockstep.
  • A non-UTF-8 request body skipped the ENTIRE body scan in every released version (CWE-693). Appending or prepending a single invalid byte evaded every body-delivered pattern. The decode is now lossy (errors="replace"); the honeypot trap-field decoder matches. Sync mirror updated in lockstep.
  • The request/response ingestion boundary now decodes invalid UTF-8 consistently across five sites using errors="surrogateescape". Two were live bypasses (top-level raw-body decode, parse_qsl in _scan_form_body, _multipart_text_parts); the other three (honeypot form/JSON, response body) are consistency fixes. A single _sanitize_for_reporting helper round-trips scanned content through surrogateescape then backslashreplace at the six reporting choke points, so a lone surrogate reaching a FileHandler no longer silently drops the audit-log entry. This is a lockstep-upgrade requirement across the ecosystem. Async and sync mirrors updated identically.
  • Nine detection categories matched only the literal spelling of an attack technique. proto_pollution (Object.prototype assignment, Object.setPrototypeOf/Reflect.setPrototypeOf), xml (PUBLIC external DTD), xss (java\tscript: control-char scheme), nosql (boolean $ne/$eq under a field key, not numeric range), file_inclusion (JSON value under template/include/tpl/module/layout), ssrf (bare metadata/instance-data host aliases), cmd_injection (Node child_process, PHP assert, Python os.exec*), code_injection (__import__('os').system), and eval( equivalents (Function, window['eval'], .constructor.constructor, setTimeout/setInterval string arg). Each adds a structural discriminator rather than another alias. Sync mirror updated in lockstep.
  • Seven detection categories widened to new request contexts. xml + query_param, xss + url_path, cmd_injection + header (resolving an internal contradiction with the existing Log4Shell row), ssrf + url_path and header, template + url_path, deserialization + header. sqli + url_path measured a real false-positive cost and is excluded. Three already-accepted benign-corpus tradeoffs became visible on the newly-exposed axis and are pinned. Sync mirror updated in lockstep.
  • New nosql [$op] bracket-operator pattern, proto_pollution arbitrary-key pattern, template {{}}/#{} shape-gated pattern, sqli tautology pattern, and cmd_injection bare $(...)/${...} + dedicated Log4Shell JNDI pattern. cmd_injection gains 10 tool names (nmap, socat, msfconsole, msfvenom, certutil, bitsadmin, powershell, pwsh, mkfifo, aria2c) and absolute-path/env-prefixed shell invocation. xss slash-separated handlers (<svg/onload=) and ssrf userinfo (http://x@localhost/) detected. sqli gains CREATE, stacked SELECT...FROM/REPLACE INTO, and EXEC xp_/sp_ system-proc patterns. Explicit-scheme RFI (?page=http://attacker/shell.php) is a dedicated file_inclusion pattern. Sync mirror updated in lockstep.
  • Request parameter NAMES now scanned for injection patterns. _scan_query_params, _scan_headers, _scan_json_value, _scan_form_body, _scan_multipart_body, and the embedded-JSON-key path feed the name to the same pipeline as the value. ?username[$ne]=admin, ?__proto__[isAdmin]=true, a JSON body key "1;DROP TABLE x", or a multipart field named __proto__[x] are detected. An excluded header's name gets only the Log4Shell JNDI shield, preserving the GHSA-motivated excluded-header design. Structured JSON body operator keys ({"username":{"$ne":null}}) are detected at any depth. Numeric range operators ($gt/$gte/$lt/$lte with a numeric literal) are not flagged as NoSQL injection: they are indistinguishable from legitimate range queries. Auth-bypass shapes ($ne null or boolean, $gt "", $regex, $where, $exists, $in) are flagged. Sync mirror updated in lockstep.
  • _LDAP_WILDCARD_EQUALS_RE repurposed into a whitespace-tolerant breakout matcher. The crontab false-positive class and its entire exclusion mechanism are deleted; requiring parens structurally retires the name list. Extensible-match attribute syntax (attr:dn:matchingRule:=value), no-wildcard breakout (admin)(cn=x)), comparator breakout (~=/>=/<=), RFC 4515 backslash-hex escapes (\29\28), and a backward depth-scan length cliff ("x"*n + "*)(uid=*" stopped detecting at n=40) are all closed. The _ldap_wildcard_chain_is_injection validator is split into three functions to stay under the xenon ceiling. Sync mirror updated in lockstep.
  • _LDAP_ATTR_EXTENSIBLE_MATCH_RE had an unbounded, uncancellable event-loop hang. The :dn/[\w.-]+ alternation branches overlap completely, giving 2^n equivalent parses; a 77-byte body hung the event loop for 7.76s. The redundant dn branch is removed; a killable-subprocess regression test pins detect() returns within 2 seconds on "*)(a" + ":dn"*30 + "X". Sync mirror updated in lockstep.
  • sqli WHERE-clause corroboration reverted; tautology pattern added. _WHERE_CLAUSE_RE no longer corroborates on a placeholder-shaped value; a new _SQLI_TAUTOLOGY_RE (\b(?:OR|AND)\s*(\d+|'[^']*'|"[^"]*")\s*=\s*\1\b) detects 1 OR 1=1-- and placeholder-prefixed tautologies at 1.0 category weight with no WHERE/SELECT dependency. SusPatternsManager._normalize_context(None) no longer raises. Sync mirror updated in lockstep.
  • Pickle GLOBAL-opcode anchor relaxed and validator hardened. Any single legal opcode prepended before GLOBAL previously defeated detection; a bounded, non-executing structural validator (_pickle_global_prefix_is_opcode_stream) replays the up-to-32-byte prefix window against a pickle._Unpickler subclass whose find_class/get_extension/persistent_load unconditionally raise. FRAME is handled directly in the dispatch loop (the predicted short-read cause was wrong; the real defect was an AttributeError). The validator's read/readline/readinto now raise on short reads instead of silently accepting truncated parses. Identifier quantifiers bounded to 100 chars/segment, 20 segments to close a quadratic ReDoS. Sync mirror updated in lockstep.
  • Negative JSON-structure result no longer suppresses the raw pattern scan. _check_value_enhanced's embedded-JSON pre-check returned unconditionally on any non-None result, so {"username":{"$ne":null}} nested one level down was invisible on query_param/header. The early return now happens only when detected is true; a negative JSON result falls through to the raw scan. Sync mirror updated in lockstep.
  • block_cloud_providers's :!region carve-out has never worked in any release that shipped it (3.2.0 through 3.12.0). Every refresh path looked the range fetcher up by the literal selector string, the KeyError was swallowed, and the provider's IP ranges stayed empty forever. All four lookup sites now normalize selectors to bare provider names before lookup. Sync mirror updated in lockstep.
  • integration-test isolation and Makefile cache-cleanup fixes. Four entrypoints hardcoded a shared REDIS_PREFIX that shadowed the PID-scoped default and let one suite's teardown wipe another's keys; Makefile and compose.yml now pass REDIS_PREFIX through only when set, and CI jobs drop the hardcoded value. make integration-test now runs the async and sync OTel integration tests as separate uv run pytest invocations so the process-global OTel providers do not collide. The 20 Makefile recipes that piped find . into xargs rm -rf now share one CLEAN_CACHES variable that hands each matched path to rm -rf as its own argument regardless of embedded whitespace. Sync mirror updated in lockstep.
  • RateLimitManager.reset() now clears redis_handler. A previously-attached Redis handle no longer survives reset() into a later test or production re-init. Sync mirror updated in lockstep.
  • Embedded-probe-in-prose known limitation disclosed, not shipped. An attack probe path embedded inside a full prose sentence (Note: the scanner hit /wp-admin/install.php) is not detected; the whole-string anchor that stops benign documentation prose from false-positiving is exactly what makes a real probe invisible inside a sentence. Three corroboration strategies were measured against a 32-malicious/43-benign corpus; none cleared both recall and false-positive gates, so this stays a documented gap rather than a shipped mitigation.
  • Test-hygiene: a "not a working attack" pin no longer calls real pickle.loads on attacker-shaped bytes. It now loads through a _BlockingUnpickler whose find_class raises before resolution, same evidential value with no path to real code execution. Sync mirror updated in lockstep.

What's Changed

  • chore(deps): bump github/codeql-action from 4.37.6 to 4.37.7 by @dependabot[bot] in #72
  • ci(3.13.0): detection regression gate, coverage floor, warnings as errors by @rennf93 in #68

Full Changelog: 3.12.0...3.13.0