Skip to content

Conversation

@oguzkocer
Copy link
Contributor

Summary

When allowedHostnames is configured, the custom hostname verifier now falls back to OkHostnameVerifier instead of rejecting all other sites. This ensures wildcard/SAN certificates work while still allowing custom overrides.

Test plan

# Checkout first commit (test only) - should fail
git checkout 6126707c
./gradlew :api:kotlin:integrationTest --tests "ApiUrlDiscoveryTest.testAllowedHostnamesDoesNotBreakValidSites"

# Checkout fix commit - should pass
git checkout cb009f75
./gradlew :api:kotlin:integrationTest --tests "ApiUrlDiscoveryTest.testAllowedHostnamesDoesNotBreakValidSites"

@oguzkocer oguzkocer requested a review from jkmassel November 26, 2025 14:03
Base automatically changed from flexible-ok-http-builder to trunk November 26, 2025 16:54
When allowedHostnames is configured, the custom hostname verifier
doesn't fall back to default OkHttp verification. This breaks SSL
verification for sites using wildcard/SAN certificates.

The test demonstrates that after configuring an allowed hostname
override, requests to other valid SSL sites (google.com) fail with
SSL errors instead of succeeding.
The custom WpRequestExecutorHostnameVerifier now falls back to
OkHostnameVerifier when the hostname is not in the allowlist.
This ensures proper handling of wildcard certificates and SANs
while still allowing custom hostname overrides.

Changes:
- Import OkHostnameVerifier from okhttp3.internal.tls
- Check custom allowlist first, then fall back to default verification
- Remove conditional verifier application (always use our verifier)
@oguzkocer oguzkocer force-pushed the fix-hostname-verifier-fallback branch from cb009f7 to 374e87e Compare November 26, 2025 16:55
@oguzkocer oguzkocer enabled auto-merge (squash) November 26, 2025 16:55
@oguzkocer oguzkocer merged commit 884ba6d into trunk Nov 26, 2025
22 checks passed
@oguzkocer oguzkocer deleted the fix-hostname-verifier-fallback branch November 26, 2025 17:39
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.

3 participants