-
Notifications
You must be signed in to change notification settings - Fork 283
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
System index permissions #2887
System index permissions #2887
Conversation
Signed-off-by: Sam <[email protected]>
Signed-off-by: Sam <[email protected]>
Signed-off-by: Sam <[email protected]>
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.
Thanks for the contribution. I've added several structural comments and a broader question about how the permission works with index pattern matching.
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
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.
I think this is good to go once Peter's comments are addressed. I did not see anything that he did not comment on that looked blocking.
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/system_indices/SystemIndicesTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/system_indices/SystemIndicesTests.java
Outdated
Show resolved
Hide resolved
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.
FYI for maintainers: This is undergoing security review and will be merged backported once the review is complete.
Backport should be blocked until the security review is complete.
…7 to be based on the same interface. ConfigModel Innerclasses (SecurityRoles, SecuriryRole and IndexPattern) Updated Accordingly. Signed-off-by: Sam <[email protected]>
src/test/java/org/opensearch/security/system_indices/SystemIndicesTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/system_indices/SystemIndicesTests.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #2887 +/- ##
============================================
+ Coverage 63.24% 64.20% +0.95%
- Complexity 3452 3471 +19
============================================
Files 263 263
Lines 20053 20112 +59
Branches 3348 3359 +11
============================================
+ Hits 12683 12912 +229
+ Misses 5741 5523 -218
- Partials 1629 1677 +48
|
QQ: Are we preventing access to security index? If not should there be a follow-up that prevents access to security-index with this permission scheme? Also @samuelcostae Could you please address CI failures? |
IMO Security index should only ever be limited to requests from the admin certificate. The admin certificate is configured in Any other user would not be able to reconnect after the security index is nuked because their permissions rely on the security index. |
Another question @samuelcostae, are we toggling this feature with a feature flag or is this enabled by default? |
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
Core issue with SecurityRoles has been resolved
src/test/java/org/opensearch/security/system_indices/SystemIndexDisabledTests.java
Show resolved
Hide resolved
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
680db06
to
8f48a10
Compare
the license header changes requested in this review have been addressed
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SecurityIndexAccessEvaluator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Darshit Chanpura <[email protected]>
2b2edbe
to
4fde43e
Compare
Signed-off-by: Darshit Chanpura <[email protected]>
@cwperks @peternied @RyanL1997 @scrawfor99 All outstanding comments have been addressed. Please review it once you get a chance. |
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.
Looks good to me. Nice job with the testing.
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.
Thanks for the work on this @DarshitChanpura and @samuelcostae
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/security/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/security/backport-2.x
# Create a new branch
git switch --create backport/backport-2887-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1379234ccd4ecf19a2c7de570724aeace7664f99
# Push it to GitHub
git push --set-upstream origin backport/backport-2887-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security/backport-2.x Then, create a pull request where the |
System index permissions Signed-off-by: Sam <[email protected]> Signed-off-by: Sam <[email protected]> Signed-off-by: Darshit Chanpura <[email protected]> Signed-off-by: Peter Nied <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]> Co-authored-by: Peter Nied <[email protected]> (cherry picked from commit 1379234)
System index permissions Signed-off-by: Sam <[email protected]> Signed-off-by: Sam <[email protected]> Signed-off-by: Darshit Chanpura <[email protected]> Signed-off-by: Peter Nied <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]> Co-authored-by: Peter Nied <[email protected]> (cherry picked from commit 1379234)
System index permissions Signed-off-by: Sam <[email protected]> Signed-off-by: Sam <[email protected]> Signed-off-by: Darshit Chanpura <[email protected]> Signed-off-by: Peter Nied <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]> Co-authored-by: Peter Nied <[email protected]> (cherry picked from commit 1379234)
Backports #2287 to 2.x (cherry picked from commit 1379234) Manual backport was required since SystemIndicesTests.java was deleted in main in lieu of the new testing for system indices. Also had to change http5 imports in tests to http4 Co-authored-by: Sam <[email protected]>
Description
This PR is based on the work done on #2681 . As the branch got stale and there were some issues with the sign-off of the commits, I created a new clean branch and generating a new PR
SecurityIndexAccessEvaluator was modified to check if an accounting trying to access a system index specifically has the "system:admin/system_index" permission for the index, and block the access if it doesn't.
A Permission needs to be set explicitly and a "*" permission will not allow access to the sistem indices.
Category: Enhancement
Why these changes are required?
To allow delegation of admin related work w.r.t system indices and allow more granular approach when working with system indices.
What is the old behavior before changes and new behavior after changes?
Before: Plugins would elevate privileges to access system indices
After: An account needs to have the additional index permission
system:admin/system_index
underallowed_actions
and the pattern (except "*") or name clearly defined underindex_pattern
section of a role, in order to read/write to indices defined as "System Indices".Issues Resolved
Testing
Automated Tests added.
Check List
New functionality includes testing
New functionality has been documented
Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.