Repository navigation
feat: log trust store certificate counts and blocklist summary - #25
Conversation
7884937 to
b35afb6
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Trust-store diagnostics can misidentify the certificate source and report misleading blocklist counts due to unreadable files, missing Java 8 filename support, and rejected properties-format entries.
4 open issues
What changed in this PR
Adds INFO-level diagnostics to make the security provider’s trust configuration and certificate counts easier to inspect.
Changes:
- Logs system and container trust-manager certificate counts, including watcher reloads.
- Adds default trust-store location, revocation settings, and JDK blocked-certificate diagnostics.
- Updates the system trust-manager logging test for the new INFO message.
| File | Description |
|---|---|
src/test/java/org/cloudfoundry/security/CloudFoundryContainerTrustManagerFactoryTest.java |
Updates the expected log level and certificate-count message. |
src/main/java/org/cloudfoundry/security/TrustStoreDiagnostics.java |
Adds trust-store, revocation, and blocked-certificate summaries. |
src/main/java/org/cloudfoundry/security/FileWatchingX509ExtendedTrustManager.java |
Logs certificate counts on initialization and reload. |
src/main/java/org/cloudfoundry/security/CloudFoundryContainerTrustManagerFactory.java |
Emits system certificate counts and trust diagnostics at INFO. |
Review effort: Balanced
d9f0606 to
014e739
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Diagnostic reads can throw SecurityException and prevent TLS setup on Java 8 with a SecurityManager, and the host-dependent blocklist test incorrectly rejects a valid unknown result.
2 open issues
4 resolved since last review
Review effort: Balanced
014e739 to
456bba3
Compare
a190643 to
a88cdf6
Compare
a88cdf6 to
27b2508
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Trust-store source resolution lacks test coverage for property overrides, file precedence, fallback, and missing files, leaving operator-reported paths vulnerable to undetected regressions.
1 open issue
Review effort: Balanced
27b2508 to
cee4ef0
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The watcher test does not assert the asynchronous reload summary or its expected count of 173 trusted certificates, so missing or incorrect logging would go undetected.
1 open issue
1 resolved since last review
Review effort: Balanced
cee4ef0 to
9db38e2
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Trust-store source resolution is deferred until manager retrieval, so a property change after initialization can make the log name a different store than the one actually used.
1 open issue
1 resolved since last review
Review effort: Balanced
9db38e2 to
7ca03ee
Compare
There was a problem hiding this comment.
🟡 Changes recommended
An explicitly empty javax.net.ssl.trustStore value produces a misleading blank-source diagnostic instead of identifying the runtime-selected default store, and this case needs a regression test.
1 open issue
1 resolved since last review
Review effort: Balanced
7ca03ee to
54cf2cc
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The trust-store diagnostic incorrectly treats NONE as an empty store even when a PKCS11 token supplies certificates, potentially contradicting the reported certificate count.
1 open issue
1 resolved since last review
Review effort: Balanced
Log the number of trusted certificates for the system and container trust managers, plus the system trust store source and the JDK blocklist summary. The system summary is logged at INFO once per JVM and at FINE afterwards, so it does not bring back the per-connection noise fixed in cloudfoundry#17.
54cf2cc to
8d7d8aa
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The trust-store summary omits an independently configured store type, and logging tests do not verify that initial summaries remain at INFO before subsequent summaries use FINE.
2 open issues
1 resolved since last review
Review effort: Balanced
…pendently Report javax.net.ssl.trustStore and trustStoreType as set, and only when at least one is set, instead of guessing which store the JDK loads. Test the INFO-once-then-FINE summary in an isolated class loader.
kiril-keranov
left a comment
There was a problem hiding this comment.
looks fine overall, left comment about a couple of gaps that might be worth addressing


Logs trust store details so operators can see what the JVM actually trusts.
blocked.certs, orblacklisted.certson Java 8, pluscaDistrustPolicies).CF_CA_CERTS): number of trusted certificates on first load and on every watcher reload.Example (Temurin 8, test CA bundle as
CF_CA_CERTS):The
System trust store:line is logged only whenjavax.net.ssl.trustStoreorjavax.net.ssl.trustStoreTypeis set, e.g.System trust store: javax.net.ssl.trustStore=/etc/ssl/custom.jks, javax.net.ssl.trustStoreType=not set.A reload logs
Updated TrustManager for <file> with N trusted certificates. If the system trust store was supplied throughinit(KeyStore)orinit(ManagerFactoryParameters), the source line says so. If the blocklist is unreadable, the line saysunknownorunavailable (access denied).Logging is best-effort: the diagnostics never affect TLS setup. Any failure while building a log message (for example a denied property read or a malformed
java.home) is reported asunavailable (<reason>)instead of being thrown, including on the watcher reload thread.Notes: