-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Entitlelments] Server policy patching via system property #124904
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
[Entitlelments] Server policy patching via system property #124904
Conversation
...ntitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParserUtils.java
Outdated
Show resolved
Hide resolved
...ntitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParserUtils.java
Outdated
Show resolved
Hide resolved
...ntitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParserUtils.java
Show resolved
Hide resolved
...ntitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParserUtils.java
Show resolved
Hide resolved
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyUtils.java
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Might have missed this, but wondering why we're handling server and plugin overrides differently. Plugin overrides always require the full policy, for server we merge a patch with the existing policy. Considering we're supporting merges, should we do the same for plugins or do we want to be able to remove entitlements this way as well (e.g. to fix a security issue).
If handling plugins and server consistently, we might as well use es.entitlements.policy.server for the server patch.
Yes, I have a follow-up PR for that, should be ready this morning. |
…24904) This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
…24904) This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
…24904) This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
|
Follow-up here: #125011 |
With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…5011) With elastic#124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…5011) With elastic#124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…5011) With elastic#124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…125086) With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…125087) With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…125078) With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
…24904) This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
…5011) With elastic#124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too. This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
Since this is in server, it's difficult to test this with IT tests, so I ended up adding unit tests + testing manually, via
with base64
Policy is parsed and patched
Verified with the debugger that the entitlement is actually added to the scope.
with base64
Policy is parsed and patched
Verified with the debugger that the scope with the entitlement is actually added to the policy.
with base64
Policy is parsed and discarded
Relates to ES-11009