fix(dpop): preserve non-default port in pinned Host header and htu#8
Merged
Conversation
DPoP htu validation failed against Authorization Servers listening on a non-default port. Two coordinated fixes: - The SSRF-safe pinned HTTP client dropped the port from the outbound Host header, so an AS reconstructing the request URI (RFC 9110 §7.2) saw a different authority than the proof's htu (RFC 9449 §4.3). It now emits the port when it is not the scheme default, with IPv6 literals bracketed (RFC 3986 §3.2.2). - DPoP proof generation normalizes the htu claim to match that Host-header rule: an explicit default port (:80/:443) is dropped, non-default ports are kept, and any userinfo is stripped so credentials never leak into the signed proof. Adds regression coverage for the Host header (IPv4 + IPv6), htu default-port normalization, and htu userinfo stripping.
RobertoIskandarani
approved these changes
May 22, 2026
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
DPoP
htuvalidation failed against Authorization Servers listening on anon-default port. This fixes two coordinated issues:
Hostheader, so an AS reconstructing the request URI (RFC 9110 §7.2) saw a
different authority than the proof's
htu(RFC 9449 §4.3). It now emits theport when it is not the scheme default; IPv6 literals stay bracketed
(RFC 3986 §3.2.2).
htuto match that rule: explicit defaultport (
:80/:443) dropped, non-default ports kept, userinfo stripped socredentials never leak into the signed proof.
Tests
hostHeaderunit table (IPv4/IPv6, default/non-default ports)htudefault-port normalization and userinfo-stripping tests