Skip to content

Commit dc28c3e

Browse files
committed
Consider any custom security provider as potentially loading JUL
1 parent 8c6ec67 commit dc28c3e

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
@@ -1349,23 +1349,22 @@ private static String ddGetEnv(final String sysProp) {
13491349
}
13501350

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

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

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

13711370
private static boolean isJFRSupported() {

0 commit comments

Comments
 (0)