Repository navigation
test: cross-language conformance parity for shared test vectors - #18
Merged
Merged
Conversation
…roviders into conformance tests - Add audit_event_vectors() test: validates PolicyCreated event fields (preset, deny_count_min, allow_count) via CollectingSink, handles no_event_when_no_sink case. Skips validate_url/validate_host/ connection_attempt/redirect_intercepted (not yet emitted by core). - Add redirect_chain_vectors() test: per-hop URL validation through UriValidator + Policy.validate_scheme for protocol rules. Handles max_redirects counting, allow_cidrs overrides, scheme downgrade detection, and FTP protocol switch. - Wire cloud_providers field in policy_decision_vectors() via CloudProvider enum, matching Go/Node behavior.
…mance tests - Add TestAuditEventVectors: loads audit_events.json, tests create_policy (verifies audit callback invoked with cloud modules) and no_event_when_no_sink. Skips validate_url/validate_host/ connection_attempt/redirect_intercepted (WASM-layer limitation). - Add TestRedirectChainVectors: per-hop IsAllowed validation with manual require_https enforcement (WASM ABI does not expose protocol rules), max_redirects counting, and allow_cidrs overrides. - Extract presetBuilder helper to reduce duplication.
…iders - Add TestAuditEvents: validates PolicyCreated event fields (preset, deny_count_min, allow_count) via AuditFunc callback, handles no_event_when_no_sink. Skips validate_url/validate_host/ connection_attempt/redirect_intercepted (not yet emitted). - Add TestRedirectChains: per-hop validate_url with manual require_https enforcement, max_redirects counting, allow_cidrs. - Add TestIpv4Ipv6Mapping: cidr_contains for both IPv4 and IPv6-mapped forms across all 7 vectors. - Wire cloud_providers in TestPolicyDecisions via builder.with_cloud(). - Add conftest fixtures: audit_event_vectors, redirect_chain_vectors, ipv4_ipv6_mapping_vectors (all using correct test_cases/cases keys).
- Add Conformance: Audit Events suite: validates PolicyCreated event fields (preset, deny_count_min, allow_count) via AuditFunc callback, handles no_event_when_no_sink. Skips validate_url/validate_host/ connection_attempt/redirect_intercepted (WASM-layer limitation). - Add Conformance: Redirect Chains suite: per-hop isAllowed validation with manual require_https enforcement, max_redirects counting, and allow_cidrs overrides across all 12 redirect chain vectors. - Create ssh.test.ts with 3 policy guard tests matching Go's protocol_ssh_test.go: blocks private IP, blocks loopback, blocks IMDS. Tests fail at the policy/TCP validation step before any SSH handshake. - Add loadTestCases helper for test_cases key alignment.
Replace redundant closures with method references, use usize::try_from instead of `as usize` casts, and prefer map_or over map().unwrap_or().
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.
Summary
audit_events.jsonandredirect_chains.jsoninto all four languages (Rust, Go, Python, Node.js), coveringPolicyCreatedaudit events and per-hop redirect chain validation with scheme enforcement andmax_redirectslimits.ipv4_ipv6_mapping.jsoncoverage to Python conformance tests and wirecloud_providersinto Rust and Pythonpolicy_decisions.jsontests.safeSshConnectblocks private IP, loopback, and IMDS).as usizecasts,map_unwrap_or).Test plan
cargo testpasses (Rust)go test ./...passes (Go)pytestpasses (Python)node --import tsx --testpasses (Node.js)cargo clippy --workspace --all-targets --all-features -- -D warningspasses