Skip to content

Conversation

ldematte
Copy link
Contributor

@ldematte ldematte commented Mar 4, 2025

Some 3rd party library is catching SecurityException as part of their code, handling it to fallback to another behaviour or to skip optional operations.
In order to maintain the same behaviour, we change NotEntitledException to inherit from SecurityException, so the try-catching code keep working as before.

@ldematte ldematte added >non-issue auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 :Core/Infra/Entitlements Entitlements infrastructure v9.1.0 and removed v9.1.0 labels Mar 4, 2025
@ldematte ldematte marked this pull request as ready for review March 4, 2025 13:29
@ldematte ldematte requested a review from a team as a code owner March 4, 2025 13:29
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Mar 4, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

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, as discussed

@ldematte ldematte merged commit 8f5de85 into elastic:main Mar 4, 2025
17 checks passed
@ldematte ldematte deleted the entitlements/not-entitled-extends-security-exception branch March 4, 2025 14:34
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 4, 2025
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x
9.0

ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 4, 2025
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 4, 2025
ldematte added a commit that referenced this pull request Mar 8, 2025
…patibility purposes (#124321)

Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 8, 2025
…patibility purposes (elastic#124321)

Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces elastic#123984
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 8, 2025
…patibility purposes (elastic#124321)

Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces elastic#123984
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 8, 2025
…patibility purposes (elastic#124321)

Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces elastic#123984
elasticsearchmachine pushed a commit that referenced this pull request Mar 8, 2025
…or compatibility purposes (#124321) (#124419)

* Make NotEntitledException inherit from AccessControlException for compatibility purposes (#124321)



Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984

* cleanup exceptions
elasticsearchmachine pushed a commit that referenced this pull request Mar 8, 2025
…or compatibility purposes (#124321) (#124418)

* Make NotEntitledException inherit from AccessControlException for compatibility purposes (#124321)



Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984

* cleanup exceptions
elasticsearchmachine pushed a commit that referenced this pull request Mar 8, 2025
…for compatibility purposes (#124321) (#124417)

* Make NotEntitledException inherit from AccessControlException for compatibility purposes (#124321)



Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984

* cleanup exceptions
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
…patibility purposes (elastic#124321)

Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces elastic#123984
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/Entitlements Entitlements infrastructure >non-issue Team:Core/Infra Meta label for core/infra team v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants