Repository navigation
feat(pipeline): reference parity for exclude_paths, client resolution, config wiring and the response pass - #81
Merged
Conversation
…r the modifier and metrics hooks
…ution, config wiring and the response pass
…from_security_config and the full response pass
…xclusions, fix stale status and WebSocket notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #80
This brings tower-guard-rs to parity with the Python reference. It needs the engine API from Guard-Core/guard-core-rs#143, so CI stays red until that merges. Merge order: guard-core-rs#143, then this PR, then axum-guard-rs (it composes this crate), with actix and rocket in any order.
exclude_pathsuses the engine matcher and a scoped pipeline: an excluded request still runs the ban check, the global IP, country and cloud rules and the rate limit, then gets the scoped response pass (metrics, security headers, CORS, modifier; no return rules).GuardExclusionScopedis the request marker.X-Forwarded-For(with_client_policy), with the IPv4-mapped canonicalization and the 403Client address could not be determinedfor a peer-less request underfail_secure. Builder layers keepfail_secure = false;from_security_configinstalls the config's policy.from_security_configgoes through the engine's sharedWiring, so every config field reaches a stage, store or hook.from_security_config_withtakes the injected telemetry agent,agent_statsreports it, metrics and the event bus come from the config, andspawn_dynamic_rulesstarts the poll loop.Hostheader against the trusted proxies instead of the connecting peer, and the IP gate decision was read before the gate ran so whitelisted IPs did not skip the geo, cloud and user-agent stages.Breaking notes:
GuardConfigErrorgainsCloud,RedisandGeovariants,agent_statsis no longerconst, a layer built from aSecurityConfigrejects a request with no peer address, and country rules without a handler or token fail closed. Not applied (no runtime in this crate):route_resolution_strict,body_read_timeout,log_format,custom_log_file. The CORS preflight still answers before the pipeline, unlike the reference.Gates run locally: check, fmt, clippy, the engine probe build, tests (173 unit, 49 integration, 38 parity), docs with
-D warnings, and the 100% line coverage gate.