Repository navigation
fix(android): Trust bundled ISRG Root X1 on API 25 and lower - #6227
sentry-junior[bot] wants to merge 11 commits into
Conversation
📲 Install BuildsAndroid
|
runningcode
left a comment
There was a problem hiding this comment.
gave it a quick look while it is still in draft mode. feel free to re-ask for a review once it is out of draft
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b4ca4ff. Configure here.
Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
- Mark SentryRootCaSslSocketFactory and SentryRootCertificates as @ApiStatus.Internal - Use StandardCharsets.UTF_8 instead of suppressing CharsetObjectCanBeUsed (minSdk 21) - Import Certificate in the test - Rewrite the changelog entry and link the TLS CA change announcement Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
On API 24-25 the custom SSLSocketFactory reads the system CAs from the Network Security Config's base config, so domain-config trust anchors (for example a private CA for a self-hosted Sentry) would no longer apply to SDK uploads. Only install the factory when the DSN host is sentry.io or a subdomain, which is the only case that needs the bundled ISRG Root X1. Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
- Catch Throwable when building the delegate SSLSocketFactory, so a RuntimeException from OEM trust store code falls back to the default factory once instead of failing every upload without retry - Use @VisibleForTesting instead of @testonly on createTrustStore - Read the DSN host with a shared DsnUtil.getHost helper that parses it like Dsn does, without creating a URI - Test a real Let's Encrypt chain with PKIX: it fails without ISRG roots and validates with the bundled root - Remove ISRG roots from the JVM's system CAs in tests, so they prove the bundled root is added Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
…delegate Errors such as OutOfMemoryError are no longer swallowed, as AGENTS.md requires. RuntimeExceptions from OEM trust store code still fall back to the default SSLSocketFactory. Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
Co-Authored-By: roman <roman.zavarnitsyn@sentry.io>
985261f to
0f67e7f
Compare
|
|
||
| ### Internal | ||
|
|
||
| - Measure the hostname cache TTL on the monotonic ticker the options provide, so that a device time change no longer shortens or extends it ([#6100](https://github.com/getsentry/sentry-java/pull/6100)) |
There was a problem hiding this comment.
Moved this in this PR too as I noticed it accidentally leaked into 8.61.0
|
Emulator check of Both images have no ISRG Root X1 (
|

📜 Description
On Android API 25 and lower, the SDK now sets
SentryOptions.sslSocketFactoryto a newSentryRootCaSslSocketFactory. That factory trusts the system CAs plus a bundled ISRG Root X1 (Let's Encrypt), which is listed on docs.sentry.io/security-legal-pii/security/ssl.How it works:
SentryRootCertificates. A unit test checks its SHA-256 fingerprint against the docs page.KeyStore, which is passed to the platform's defaultTrustManagerFactory. Chain validation is still done by the platform. There is no customX509TrustManager.options.getSslSocketFactory()is only read byHttpConnection, so the change only applies to the SDK's ownAsyncHttpTransportuploads. Other connections in the app keep using the platform defaults. No network security config is involved.SSLContextis built lazily on first use, on the transport thread. If building it fails, we log an error and fall back to the default factory.sslSocketFactory, it is kept.💡 Motivation and Context
Sentry is moving its TLS certificates from DigiCert to Let's Encrypt and Google Trust Services (announcement). Here is which roots each Android version ships, based on the AOSP CA store:
TODO(2028-01-28)inSentryRootCertificates.Known limitation: this only helps apps that update to an SDK version containing this fix.
💚 How did you test it?
Unit tests:
SentryRootCaSslSocketFactoryTest: checks the bundled root's fingerprint, that the merged trust store keeps every system-trusted CA, and that the delegate is created lazily and only once.AndroidOptionsInitializerTest: checks that the factory is set on API 25, not set on API 26, and that a user-provided factory is kept.This hasn't been verified on a real API 21–25 device or emulator against a Let's Encrypt endpoint yet.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
SentryRootCertificates).via roman.
--
View Junior Session [Sentry]