Skip to content

strip trailing dot before matching spki pinning rules - #902

Open
dxbjavid wants to merge 1 commit into
apache:masterfrom
dxbjavid:spki-pin-trailing-dot
Open

dxbjavid wants to merge 1 commit into
apache:masterfrom
dxbjavid:spki-pin-trailing-dot

Conversation

@dxbjavid

Copy link
Copy Markdown
Contributor

SpkiPinningClientTlsStrategy matches pin rules against the host exactly as given, so a request to https://api.example.com./ yields api.example.com. and no rule applies, while the default built-in hostname check still accepts it because the JDK drops the root dot from SNI. In practice any CA-trusted certificate for a pinned host appears to be accepted whenever the URL is spelt in its absolute form (for instance after a redirect), which rather defeats the pinning; against a local TLS server with a non-matching pin the plain host is rejected while the dotted one returns 200. The patch strips a single trailing dot from both the request host and the configured patterns before matching, with a regression test covering the exact and wildcard cases.

@ok2c
ok2c requested a review from arturobernalg October 25, 2026 10: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.

1 participant