fix(api): preserve raw colons in role-ID path segment (DPoP htu mismatch)#43
Merged
Conversation
…tu mismatch encodeURIComponent encodes the colons in 'ssh:Tide-GW:My Server:demo' as %3A, but the DPoP htu canonicalization on this server keeps them raw. Result: the URL on the wire is …/ssh%3ATide-GW%3A…/ but the signed htu claim is …/ssh:Tide-GW:…/, so the server rejects the request with 401 "DPoP proof invalid: htu mismatch". RFC 3986 allows ':' in path segments as pchar, so restoring the raw colons after encodeURIComponent is safe and makes the wire URL match what DPoP canonicalizes to.
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
After #42 the SSH connect path correctly builds
ssh:<gw>:<srv>:<user>role IDs and fetches viagetByRole(...), but the request now fails with 401 "DPoP proof invalid: htu mismatch":encodeURIComponentencodes:as%3A, but the DPoPhtucanonicalization on this server keeps colons raw. The wire URL contains%3Awhile the signedhtuclaim contains:→ server rejects with 401 before our route ever runs.RFC 3986 permits
:in path segments aspchar. Restoring raw colons afterencodeURIComponentis safe and makes the wire URL match what DPoP canonicalizes to.Change
client/src/lib/api.ts—getByRole:Only one call site uses this URL pattern with a role-ID containing
:; audited via grep.Test plan
ssh:Tide-GW:My Server:demo)401 (Unauthorized)/ no "htu mismatch" in browser console[PolicyTrace USE]and[PolicyTrace ATTACH]from debug(policy): add SHA-256 trace logs at sign / use / attach #41 now appear and carry matchingdtv_sha