Skip to content

Commit

Permalink
Remove unused EntitlementInternals (#116473)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldematte authored Nov 8, 2024
1 parent bc270bd commit f88a004
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
4 changes: 4 additions & 0 deletions libs/entitlement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ This module implements mechanisms to grant and check permissions under the _enti
The entitlements system provides an alternative to the legacy `SecurityManager` system, which is deprecated for removal.
The `entitlement-agent` instruments sensitive class library methods with calls to this module, in order to enforce the controls.

This feature is currently under development, and it is completely disabled by default (the agent is not loaded). To enable it, run Elasticsearch with
```shell
./gradlew run --entitlements
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

import java.util.Optional;

import static org.elasticsearch.entitlement.runtime.internals.EntitlementInternals.isActive;

/**
* Implementation of the {@link EntitlementChecker} interface, providing additional
* API methods for managing the checks.
Expand All @@ -25,13 +23,6 @@
public class ElasticsearchEntitlementChecker implements EntitlementChecker {
private static final Logger logger = LogManager.getLogger(ElasticsearchEntitlementChecker.class);

/**
* Causes entitlements to be enforced.
*/
public void activate() {
isActive = true;
}

@Override
public void checkSystemExit(Class<?> callerClass, int status) {
var requestingModule = requestingModule(callerClass);
Expand Down Expand Up @@ -66,10 +57,6 @@ private static Module requestingModule(Class<?> callerClass) {
}

private static boolean isTriviallyAllowed(Module requestingModule) {
if (isActive == false) {
logger.debug("Trivially allowed: entitlements are inactive");
return true;
}
if (requestingModule == null) {
logger.debug("Trivially allowed: Entire call stack is in the boot module layer");
return true;
Expand All @@ -81,5 +68,4 @@ private static boolean isTriviallyAllowed(Module requestingModule) {
logger.trace("Not trivially allowed");
return false;
}

}

This file was deleted.

0 comments on commit f88a004

Please sign in to comment.