Repository navigation
feat: URL rule allow/deny system with cross-language support - #12
Merged
Merged
Conversation
Implement UrlRule and UrlRuleset in ressrf-core for URL-level allow/deny filtering beyond CIDR-based policies. Rules support scheme exact match, host glob (* = single DNS label), path glob (*/** segments), and optional full-URL regex (1MB automaton limit, ReDoS-safe via the regex crate). Deny rules are evaluated first, then allow rules. When allow rules are configured, unmatched URLs are blocked. Per-rule bypass_ip_check flag allows trusted endpoints to skip IP-level validation entirely. Wire into PolicyBuilder/Policy with validate_url_rules() and is_request_allowed() methods. Extend WASM ABI PolicyConfig with optional url_rules field. Add shared test vectors (14 cases) and Rust integration tests.
Add URLRule struct and WithURLAllow/WithURLDeny methods to PolicyBuilder. URL rules are serialized into the WASM PolicyConfig and evaluated at policy check time. Add conformance tests consuming shared url_rules.json vectors.
Expose URL rule support via PyO3 bindings. PolicyBuilder gains url_allow() and url_deny() keyword-argument methods mapping to ressrf-core UrlRule. CorePolicy.validate_url checks URL rules first, respecting bypass_ip_check. Add conformance tests consuming shared url_rules.json vectors.
Add UrlRule and UrlRulesConfig interfaces. PolicyBuilder gains urlAllow() and urlDeny() methods. Policy.create maps UrlRule to WASM snake_case config via ruleToWasm helper. Export new types from index. Add conformance tests consuming shared url_rules.json vectors.
Create individual READMEs for all sub-projects (ressrf-core, ressrf-http, ressrf-ssh, ressrf-tcp, ressrf-tracing, ressrf-wasm, Go, Python, Node.js) with full API tables, code examples, and feature descriptions. Refactor root README to high-level overview with links to per-package docs. Add URL rules section with cross-language examples to root and all relevant package READMEs.
gonzaloserrano
added a commit
that referenced
this pull request
May 27, 2026
The -out default `internal/engine` is relative to the current working directory, not "relative to repo root" as the help string claimed. A contributor running gen-data from the actual repo root following the help text would write to <repo-root>/internal/engine/ which doesn't exist; if their shell auto-creates the dir, generated files land in the wrong place while the engine package keeps stale tables. The doc comment at the top of main.go already says to run from go-native/ressrf/, so the default does land in the right place when the documented workflow is followed. The flag help just disagreed. Addresses td-code-review finding #12.
gonzaloserrano
added a commit
that referenced
this pull request
May 27, 2026
The -out default `internal/engine` is relative to the current working directory, not "relative to repo root" as the help string claimed. A contributor running gen-data from the actual repo root following the help text would write to <repo-root>/internal/engine/ which doesn't exist; if their shell auto-creates the dir, generated files land in the wrong place while the engine package keeps stale tables. The doc comment at the top of main.go already says to run from go-native/ressrf/, so the default does land in the right place when the documented workflow is followed. The flag help just disagreed. Addresses td-code-review finding #12.
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
ressrf-coresupporting scheme exact match, host globs (*= single DNS label), path globs (*/**segments), and optional full-URL regex (1MB automaton limit, ReDoS-safe). Deny rules evaluate first; per-rulebypass_ip_checkflag allows trusted endpoints to skip IP validation.WithURLAllow/WithURLDeny(Go),url_allow/url_deny(Python), andurlAllow/urlDeny(Node.js) on each language'sPolicyBuilder.tests/vectors/url_rules.json) and cross-language conformance tests in Rust, Go, Python, and Node.js.Test plan
cargo test --workspacepasses (including url_rules vector tests)cargo clippy --workspace --all-targets --all-features -- -D warningscleancargo fmt --all -- --checkcleango test ./...)uv run pytest)node --import tsx --test)