Skip to content

Commit 8f7e5e6

Browse files
committed
Special case bouncycastle for security plugin
1 parent 0dd3a99 commit 8f7e5e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/framework/src/main/java/org/elasticsearch/bootstrap/TestScopeResolver.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
import java.util.TreeMap;
2222
import java.util.function.Function;
2323

24+
import static org.elasticsearch.entitlement.runtime.policy.PolicyManager.ALL_UNNAMED;
25+
import static org.elasticsearch.entitlement.runtime.policy.PolicyManager.ComponentKind.PLUGIN;
26+
2427
public record TestScopeResolver(Map<String, PolicyManager.PolicyScope> scopeMap) {
2528

2629
private static final Logger logger = LogManager.getLogger(TestScopeResolver.class);
@@ -31,6 +34,12 @@ PolicyManager.PolicyScope getScope(Class<?> callerClass) {
3134

3235
var location = callerCodeSource.getLocation().toString();
3336
var scope = scopeMap.get(location);
37+
if (scope == null) {
38+
if (callerClass.getPackageName().startsWith("org.bouncycastle")) {
39+
scope = new PolicyManager.PolicyScope(PLUGIN, "security", ALL_UNNAMED);
40+
logger.debug("Assuming bouncycastle is part of the security plugin");
41+
}
42+
}
3443
if (scope == null) {
3544
logger.warn("Cannot identify a scope for class [{}], location [{}]", callerClass.getName(), location);
3645
return PolicyManager.PolicyScope.unknown(location);

0 commit comments

Comments
 (0)