Repository navigation
fix: accept percent-encoded runtime path prefixes in wss mint (#168) - #178
Conversation
The mint refused any runtime containing `%`, so a valid percent-encoded path prefix such as `ws://host/pod%20a` stopped minting. The runtime is now parsed for percent escapes: `%XX` is allowed in the path prefix only, malformed escapes are refused, and the decoded path must not carry userinfo, query, fragment or control characters. The admin credential is also checked against the decoded runtime, so an encoded credential cannot be persisted in grants.json. Left open on #168 for the owner: minimum credential length, trust root alignment between mint and dial, and the two LOW items on error body detail and redaction. Tests: - wss_mint_accepts_a_percent_encoded_runtime_prefix (fails on main) - a_percent_encoded_credential_inside_the_runtime_is_refused_before_any_request (fails on main) - a_malformed_or_smuggling_percent_escape_in_the_runtime_is_refused (passes on main, guards the refusal) Rust: 601 passed, 1 failed (proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic), which also fails on current main. Swift: swift build and swift test, 852 executed, 0 failures.
cargo fmt --check failed in CI on the #168 change. Formatting only. Re-run on this head: cargo fmt --check passes. cargo test: 601 passed, 1 failed (proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic, also fails on current main). Swift: swift build, swift test: 852 executed, 0 failures.
CI clippy (-D warnings) rejected map_or(true, ..) as unnecessary_map_or. Same behaviour. Re-run on this head: cargo fmt --check passes; cargo clippy --all-targets -D warnings passes; cargo test: 601 passed, 1 failed (proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic, also fails on current main). One run also failed liveness_tests::calls_running_when_the_socket_closes_are_cancelled under load; it passes 5 of 5 when run alone and passed on the next full run. Swift: swift build, swift test: 852 executed, 0 failures.
|
Important CHANGES REQUESTED What This PR DoesRefs #168. How It Works
Findings
Finding Details🟡 F1: Encoded path separators and dot segments are acceptedInputs such as Plain Requested change: After decoding, reject 🟡 F2: Lossy decoding
This is not a credential bypass: lossy conversion keeps valid spans intact, so a percent-encoded credential is still found. It is still fail-open by construction. Requested change: Use 🟡 F3: The whitespace policy does not match the commentThe raw check rejects Requested change: Choose a policy. Either allow encoded whitespace, fix the comment and test the policy (for example 🟡 F4: No canonical representationThe validator decodes Requested change: At minimum, document that the raw form is canonical and that the decoded form is used only for refusal checks. Longer term, parse the runtime once with a URL parser (for example the 🟢 F5: Well-scoped fix with failing-first tests
Baseline Check
CI and Validation
Reviewer Verdicts
No external reviewer feedback on this PR. What's Good (🟢)
5. Three Reasons We Might Not Need This PR
|
Refs #168. This PR fixes only the percent-encoded runtime prefix item.
Change
mint_innerno longer rejects every%in the runtime. A%XXescape is accepted in the path prefix. A malformed escape (%zz,%2) is refused.@,?,#or\, so an escape cannot smuggle userinfo, a query or a fragment past the check. A%in the host part is refused.grants.json.Tests
wss_mint_accepts_a_percent_encoded_runtime_prefix: fails on main, passes with this change.a_percent_encoded_credential_inside_the_runtime_is_refused_before_any_request: fails on main, passes with this change.a_malformed_or_smuggling_percent_escape_in_the_runtime_is_refused: passes on main. It guards the refusal path that stays in place.Results on the final head (ece9a9f)
swift buildandswift teston the build host: 852 executed, 0 failures.cargo teston the build host: 601 passed, 1 failed. The failure isproc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic. The same test fails on current main, so it predates this change.Left open on #168 for the owner