Skip to main content

Crate guard_core_engine

Crate guard_core_engine 

Source

Modules§

behavior
The behavior-rule engine, ported from the reference behavior handler and its mixins. The go port is the structural template.
binary_islands
Binary islands reduction, ported from guard_core/detection_engine/ binary_islands.py (upstream commit 5f399234).
body_scan
Request body value extraction: the engine-side port of the reference body-scanning split, mirroring the Go engine’s bodyscan.go.
cloud_fetch
The cloud-provider range lifecycle: the fetch payload parsers, the Azure ServiceTags URL extraction, the refresh cadence with the single-flight gate, and the store-backed cache layers.
cloud_provider
The cloud-provider IP table and block selectors.
compiler
cors
CORS handling, ported from the reference response-side CORS surface.
custom_checks
The custom function seams: the reference pipeline’s ninth and seventeenth checks.
decorators
The reference decorator system (guard_core/decorators/*.py): the SecurityDecorator registry and its mixin method surface, ported method for method.
detect
Public detection entry point: the spec 4.0.2 SusPatternsManager.detect pipeline (preprocess, four scan views, semantic analysis, scoring).
detection_exclusions
Per-request detection exclusion resolution and the multi-surface request scan.
distributed
The distributed-store seam: the engine-side traits and key helpers for Redis-backed (or any backend) rate limiting and bans.
dynamic_rules
The dynamic-rules carrier: the reference DynamicRules wire model and its manager-side logic (handlers/_dynamic_rule_*.py + _dynamic_rules.py).
emergency_mode
The emergency-mode gate: the reference pipeline’s second check.
geo
The country gate: whitelist_countries and blocked_countries.
headers_auth
The required-headers and authentication gate.
https_enforcement
The HTTPS enforcement gate: the reference pipeline’s third check.
ip_ban
The dynamic IP ban store and the auto-ban engine: ban_ip with a duration, expiry-honoring is_banned, and the per-IP violation counters with the threshold resolution both are fed by.
ip_extraction
The client-IP extraction from the forwarded chain: the reference _utils/ip_extraction.py’s depth-limited X-Forwarded-For walk, driven by the trusted_proxies / trusted_proxy_depth knobs.
ip_gate
The global IP gate: whitelist, blacklist, and exempt_ips.
json_walk
Ordered JSON body walk, ported from the Go engine’s jsonwalk.go, which ports guard_core/_utils/body_json_scan.py and embedded_json_scan.py.
multipart_scan
Line-based multipart scanner mirroring the extracted-value semantics of Python’s email feedparser for multipart/form-data bodies.
patterns
Detection wiring for the compiled pattern table and its dispatch.
payload
The data contracts the reference passes between the configuration surface, the block hook, and the response-side pass.
performance_monitor
The pattern performance monitor: per-pattern execution stats, the anomaly-detection trio, and the sanitized callbacks.
preprocessor
Content preprocessing ported from guard_core/detection_engine/preprocessor.py.
rate_limit
The sliding-window rate limiter: per client IP, global scope or per endpoint.
redis_schema
The Redis key schema (spec section 08, interop): every key pattern, every value format, and the ban-key migration, byte-compatible with the Go and Python family ports.
redos
The pattern-safety chain: the full port of the reference’s ReDoS defenses (guard_core/detection_engine/_redos_*).
referrer
The route referrer gate: the reference pipeline’s eighth check.
request_limits
The request size and content-type gate: max_request_size and allowed_content_types.
request_logging
The request-logging pass: the reference pipeline’s fourth check.
route_config
The per-route configuration carrier: the reference RouteConfig (guard_core/decorators/route_config.py).
security_config
The unified configuration surface: the reference SecurityConfig (guard_core/_security_config_fields.py, 129 fields) fieldized for the Rust family.
security_headers
Security headers management, ported from the reference handler.
semantic
time_window
The route time-window gate: the reference pipeline’s tenth check.
user_agent
The blocked user-agent pattern filter.