SashaMIT opened PR #14123 from SashaMIT:fix/wasi-http-p2-authority-port-validation to bytecodealliance:main:
Summary
- Align WASIp2
OutgoingRequest::set_authoritywith the existing WASIp3parse_authoritycheck so empty, non-numeric, and out-of-range ports are rejected.- Share that helper at crate scope (
authority.rs) so p2 and p3 cannot drift.- Extend unit coverage (
example.com:65536,[::1]:abc).
http::uri::Authorityaccepts authorities such asexample.com:andexample.com:abc. p3 already rejects those (#13739 class). p2 did not. With a bad authority,default_send_requestsees no numeric port and appends the scheme default, producing broken connect targets such asexample.com::443/example.com:abc:443.Threat model: guest-controlled wasi-http authority string on the host outbound connect / TLS path. Fail closed before host I/O, matching p3.
Test plan
- [x]
cargo test -p wasmtime-wasi-http --lib authority_accepts --features 'p2,p3'- [x] Revert-tested: removing the
port_u16reject makes the new cases failMade with Cursor
SashaMIT requested wasmtime-wasi-reviewers for a review on PR #14123.
SashaMIT requested dicej for a review on PR #14123.
SashaMIT updated PR #14123.
SashaMIT commented on PR #14123:
Fixed Rustfmt (trailing blank line after moving the authority tests).
:thumbs_up: dicej submitted PR review:
Thanks!
dicej added PR #14123 fix(wasi-http): validate ports in p2 set_authority like p3 to the merge queue.
:check: dicej merged PR #14123.
dicej removed PR #14123 fix(wasi-http): validate ports in p2 set_authority like p3 from the merge queue.
SashaMIT commented on PR #14123:
Glad it landed, thanks for the review.
Last updated: Aug 30 2026 at 10:08 UTC