Skip to content

Commit

Permalink
[Entitlements] Fix "No SecurityManager when entitlements are enabled" (
Browse files Browse the repository at this point in the history
  • Loading branch information
ldematte authored Jan 8, 2025
1 parent 80547f8 commit 28ce53f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static Stream<String> maybeWorkaroundG1Bug() {

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
private static Stream<String> maybeAllowSecurityManager(boolean useEntitlements) {
if (useEntitlements == false && RuntimeVersionFeature.isSecurityManagerAvailable()) {
if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
// Will become conditional on useEntitlements once entitlements can run without SM
return Stream.of("-Djava.security.manager=allow");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
public class ExampleSecurityExtension implements SecurityExtension {

static {
if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
final boolean useEntitlements = Boolean.parseBoolean(System.getProperty("es.entitlements.enabled"));
if (useEntitlements == false && RuntimeVersionFeature.isSecurityManagerAvailable()) {
// check that the extension's policy works.
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
System.getSecurityManager().checkPropertyAccess("myproperty");
Expand Down

0 comments on commit 28ce53f

Please sign in to comment.