Fix self-signed certificate handling without SAN ("Hostname not verified") - #6646
Open
mahibi wants to merge 2 commits into
Open
Fix self-signed certificate handling without SAN ("Hostname not verified")#6646mahibi wants to merge 2 commits into
mahibi wants to merge 2 commits into
Conversation
…rusted The hostname verifier rejected any certificate lacking a matching Subject Alternative Name, even after the user explicitly trusted that exact certificate via the certificate dialog. Fall back to the manual trust store when the strict SAN check fails, so legacy self-signed certificates that only set a Common Name work once accepted. Assisted-by: Claude Code:claude-sonnet-5 Signed-off-by: Marcel Hibbe <[email protected]>
Covers the hostname verifier fallback: a certificate without a matching SAN is rejected unless the user already trusted it manually, a certificate with a matching SAN is accepted, and missing/unreadable peer certificates are rejected. Verified these tests fail against the pre-fix TrustManager. Adds okhttp-tls as a test dependency to generate real self-signed certificates (with and without a SAN) instead of certificate mocks, since KeyStore.setCertificateEntry needs an encodable certificate. Assisted-by: Claude Code:claude-sonnet-5 Signed-off-by: Marcel Hibbe <[email protected]>
Collaborator
Author
|
/backport to stable-25.0.x |
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/33885571520/artifacts/9941962206 |
rapterjet2004
approved these changes
Sep 4, 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.
improves the situation for #5509 and #5439
The hostname verifier rejected any certificate lacking a matching Subject Alternative Name (SAN) — e.g. legacy self-signed certificates that only set a Common Name — even after the user had already explicitly trusted that exact certificate via the "untrusted certificate" dialog. The manual trust decision was silently discarded one step later during hostname verification.
Now, when the strict SAN-based check fails, the verifier falls back to checking whether the user already trusted this specific certificate. Certificates that are neither CA-signed nor manually trusted are still rejected as before — this only relaxes the check for certificates the user has explicitly accepted.
Added unit tests covering the hostname verifier's behavior (SAN match, no-SAN rejected/accepted depending on manual trust, missing/unreadable peer certificates).
Test plan
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)