Skip to content

feat(go-native): let callers accept "--" host labels - #72

Merged
mostafa merged 6 commits into
mainfrom
gsr/add-double-dash-hostname-option
Sep 21, 2026
Merged

mostafa merged 6 commits into
mainfrom
gsr/add-double-dash-hostname-option

Conversation

@gonzaloserrano

Copy link
Copy Markdown
Contributor

Closes #71

The URI validator rejects any host label containing -- outside the xn-- punycode prefix. That blocks legitimate hostnames such as S3 Express directory buckets, and the Go native port had no way to relax it, unlike the Rust core's UriValidator::reject_double_dash.

This adds WithDoubleDashHostsAllowed() for NewPolicy and NewAllowListPolicy. The default is unchanged and the shared conformance vector still passes. The opt-out does not touch denied suffixes, bare-IP and CIDR rules, control-character rejection, or the scheme check.

No new shared vector: the URL-validation vectors carry no per-case policy config, so an opt-in knob cannot be expressed there without changing every language's runner. The other bindings build the validator per request without config, so exposing the knob there is a separate change.

The URI validator rejects any host label containing "--" outside the
xn-- punycode prefix. That blocks legitimate hostnames such as S3
Express directory buckets (name--use1-az4--x-s3.s3express-...), and the
Go native port had no way to relax it, unlike the Rust core's
UriValidator::reject_double_dash.

Add WithDoubleDashHostsAllowed for NewPolicy and NewAllowListPolicy,
backed by SetRejectDoubleDashHosts on the engine validator. The default
is unchanged and the shared conformance vector still passes. Every
other check (denied suffixes, bare-IP and CIDR rules, control
characters, schemes) is unaffected by the opt-out.

Closes #71
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ gonzaloserrano
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

Unpinned stable clippy gained unused_async_trait_impl, which flags the test-only DnsBackend impl that answers without awaiting. The trait method is async, so allow the lint on that impl.
The Build WASM job rebuilt core.wasm on every run and pushed the result
as a github-actions[bot] commit. With an unpinned stable toolchain, that
put a new binary on PRs that touched no Rust at all and made the CLA
check flag the bot as a contributor.

Diff the PR base (or the previous push) against HEAD for the Rust
workspace, the build script, and this workflow, and skip the toolchain
install, build, and commit steps when none of them changed. The job
still runs so the Go and Node jobs that depend on it are unaffected.

@mostafa mostafa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Go wiring is default-safe and the existing tests cover the main paths. A few notes on the public knob, coverage, and the wasm skip.

Comment thread go-native/ressrf/policy.go
Comment thread go-native/ressrf/policy_test.go
Comment thread go-native/ressrf/policy_test.go Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread go-native/ressrf/internal/engine/policy.go
Review on #72: the opt-out is global, not S3 Express specific, and the
godoc did not say so. Spell out that every "--" hostname passes the
heuristic, point customer-URL callers at an allow-list pairing, and
note that the Rust PolicyBuilder does not expose the setter yet.

Tests: pin that the opt-out cannot skip allow-list mode, and check
control characters in the host rather than only in the path. CI: also
watch rust-toolchain files as core.wasm inputs.
… event

Review on #72: operators could not see from the audit stream that
hostname hardening was relaxed. Add double_dash_hosts_allowed to the
policy_created fields. Go native only, since the Rust core does not
expose the setter on its builder yet.

@mostafa mostafa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@mostafa
mostafa merged commit ae21f4a into main Sep 21, 2026
27 of 28 checks passed
@mostafa
mostafa deleted the gsr/add-double-dash-hostname-option branch September 21, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URI validator rejects legitimate -- hostnames such as S3 Express directory buckets

3 participants