Skip to content

Commit 5abbcde

Browse files
committed
Consider any custom security provider as potentially loading JUL
1 parent 95f2490 commit 5abbcde

File tree

1 file changed

+7
-8
lines changed
  • dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap

1 file changed

+7
-8
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,23 +1348,22 @@ private static String ddGetEnv(final String sysProp) {
13481348
}
13491349

13501350
private static boolean okHttpMayIndirectlyLoadJUL() {
1351-
if (isIBMSASLInstalled() || isACCPInstalled()) {
1352-
return true; // 'IBMSASL' and 'ACCP' crypto providers can load JUL when OkHttp accesses TLS
1351+
if (isCustomSecurityProviderInstalled() || isIBMSASLInstalled()) {
1352+
return true; // custom security providers may load JUL when OkHttp accesses TLS
13531353
}
13541354
if (isJavaVersionAtLeast(9)) {
13551355
return false; // JDKs since 9 have reworked JFR to use a different logging facility, not JUL
13561356
}
13571357
return isJFRSupported(); // assume OkHttp will indirectly load JUL via its JFR events
13581358
}
13591359

1360-
private static boolean isIBMSASLInstalled() {
1361-
return ClassLoader.getSystemResource("com/ibm/security/sasl/IBMSASL.class") != null;
1360+
private static boolean isCustomSecurityProviderInstalled() {
1361+
return ClassLoader.getSystemResource("META-INF/services/java.security.Provider") != null;
13621362
}
13631363

1364-
private static boolean isACCPInstalled() {
1365-
return ClassLoader.getSystemResource(
1366-
"com/amazon/corretto/crypto/provider/AmazonCorrettoCryptoProvider.class")
1367-
!= null;
1364+
private static boolean isIBMSASLInstalled() {
1365+
// need explicit check as this is installed without using the service-loader mechanism
1366+
return ClassLoader.getSystemResource("com/ibm/security/sasl/IBMSASL.class") != null;
13681367
}
13691368

13701369
private static boolean isJFRSupported() {

0 commit comments

Comments
 (0)