Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to entitlements only for JDK 24+ #119885

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jan 9, 2025

Since entitlements are still being developed, we are not yet ready to enable them for all JDK versions. But we must use them for JDK 24+ since the security manager is not useable there. This commit tweaks the logic for determining whether to use entitlements to take into account the runtime version.

Since entitlements are still being developed, we are not yet ready to
enable them for all JDK versions. But we must use them for JDK 24+ since
the security manager is not useable there. This commit tweaks the logic
for determining whether to use entitlements to take into account  the
runtime version.
@rjernst rjernst added :Core/Infra/Core Core issues without another label >refactoring auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 labels Jan 9, 2025
@rjernst rjernst requested a review from a team as a code owner January 9, 2025 16:42
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Jan 9, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@prdoyle prdoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

final boolean useEntitlements = Boolean.parseBoolean(System.getProperty("es.entitlements.enabled"));
final boolean entitlementsExplicitlyEnabled = Booleans.parseBoolean(System.getProperty("es.entitlements.enabled", "false"));
// java 24+ only supports entitlements, but it may be enabled on earlier versions explicitly
final boolean useEntitlements = Runtime.version().feature() >= 24 || entitlementsExplicitlyEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want, there is RuntimeVersionFeature.isSecurityManagerAvailable() (created so we can easily track the places where we make this check)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 575a198

Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rjernst rjernst merged commit 38b2fc5 into elastic:main Jan 10, 2025
15 checks passed
@rjernst rjernst deleted the entitlements/sm_by_default branch January 10, 2025 17:19
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

rjernst added a commit to rjernst/elasticsearch that referenced this pull request Jan 10, 2025
Since entitlements are still being developed, we are not yet ready to
enable them for all JDK versions. But we must use them for JDK 24+ since
the security manager is not useable there. This commit tweaks the logic
for determining whether to use entitlements to take into account  the
runtime version.
elasticsearchmachine pushed a commit that referenced this pull request Jan 10, 2025
Since entitlements are still being developed, we are not yet ready to
enable them for all JDK versions. But we must use them for JDK 24+ since
the security manager is not useable there. This commit tweaks the logic
for determining whether to use entitlements to take into account  the
runtime version.

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Core/Infra/Core Core issues without another label >refactoring Team:Core/Infra Meta label for core/infra team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants