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

Introduce dfm_empty_overrides_all setting to enable role without dls/fls to override roles with dls/fls #1735

Merged
merged 4 commits into from
Apr 12, 2022

Conversation

cliu123
Copy link
Member

@cliu123 cliu123 commented Apr 1, 2022

Signed-off-by: cliu123 [email protected]

Description

The default behavior of security plugin DLS and FLS follows the least privilege principle. When a user has more than 1 role, the role with the most restrictive permissions is honored.

With the new setting dfm_empty_overrides_all setting explicitly being set to true, security plugin enables role without dls/fls to override roles with dls/fls.

The setting dfm_empty_overrides_all is false by default.

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation) New feature

Issues Resolved

#1572

Testing

ITs

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.

@cliu123 cliu123 requested a review from a team April 1, 2022 06:46
@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch from 1bde700 to 2030b14 Compare April 1, 2022 06:51
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2022

Codecov Report

Merging #1735 (c4b65c1) into main (54a920b) will increase coverage by 0.06%.
The diff coverage is 79.41%.

@@             Coverage Diff              @@
##               main    #1735      +/-   ##
============================================
+ Coverage     60.42%   60.48%   +0.06%     
- Complexity     3197     3201       +4     
============================================
  Files           253      253              
  Lines         18093    18116      +23     
  Branches       3245     3251       +6     
============================================
+ Hits          10933    10958      +25     
  Misses         5579     5579              
+ Partials       1581     1579       -2     
Impacted Files Coverage Δ
...pensearch/security/securityconf/ConfigModelV6.java 0.00% <ø> (ø)
...g/opensearch/security/support/ConfigConstants.java 94.44% <ø> (ø)
...pensearch/security/securityconf/ConfigModelV7.java 62.47% <77.41%> (+0.16%) ⬆️
.../opensearch/security/OpenSearchSecurityPlugin.java 79.66% <100.00%> (+0.04%) ⬆️
...earch/security/privileges/PrivilegesEvaluator.java 71.93% <100.00%> (+0.09%) ⬆️
...a/org/opensearch/security/tools/SecurityAdmin.java 37.74% <0.00%> (+0.24%) ⬆️
...security/configuration/DlsFlsFilterLeafReader.java 60.28% <0.00%> (+1.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54a920b...c4b65c1. Read the comment docs.

Copy link
Contributor

@rursprung rursprung left a comment

Choose a reason for hiding this comment

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

as usual: this is not meant as a thorough review, for that i'm not familiar enough with this code base (and security things should never be reviewed by people who aren't familiar with them, i.e. me 😄)


@Test
public void testDFMUnrestrictedUser() throws Exception {
// admin user sees all, no dfm restrictions apply
Copy link
Contributor

Choose a reason for hiding this comment

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

why not move such descriptive comments up into a javadoc on the test method? then it's better visible that this is the description of the test method.
(same for the other tests below)

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. Java doc is actually barely used in this repo, especially in the tests. But this is a great idea!

@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch from 2030b14 to 3f106b0 Compare April 7, 2022 05:44
@rursprung
Copy link
Contributor

it seems that the newly pushed commit only changes the author (thanks!) but didn't address any of the other findings?

@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch 3 times, most recently from 0613072 to 1e1ddbd Compare April 8, 2022 06:13
…fls to override roles with dls/fls

Signed-off-by: cliu123 <[email protected]>
@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch from 1e1ddbd to ab668d6 Compare April 8, 2022 06:18
Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Thank you for removing the import changes and comments around the tests, much more readable!

Very close now, a few callouts remain.

@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch 2 times, most recently from 560c2cd to 9ed11a1 Compare April 8, 2022 16:35
Co-authored-by: Ralph Ursprung <[email protected]>
Signed-off-by: cliu123 <[email protected]>
@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch from 3683270 to efafa9d Compare April 8, 2022 18:33
@cliu123 cliu123 force-pushed the dfm_empty_overrides_all branch from 5d676e0 to c4b65c1 Compare April 10, 2022 06:07
@cliu123 cliu123 requested a review from a team April 12, 2022 05:35
@peternied
Copy link
Member

@opensearch-project/security Could we get a second reviewer to take a look?

@cliu123 cliu123 merged commit 7e6b62c into opensearch-project:main Apr 12, 2022
@cliu123 cliu123 deleted the dfm_empty_overrides_all branch April 12, 2022 17:33
@opensearch-project opensearch-project deleted a comment from rursprung Nov 25, 2022
wuychn pushed a commit to ochprince/security that referenced this pull request Mar 16, 2023
…fls to override roles with dls/fls (opensearch-project#1735)

* Introduce dfm_empty_overrides_all setting to enable role without dls/fls to override roles with dls/fls

Signed-off-by: cliu123 <[email protected]>

Co-authored-by: jochenkressin <[email protected]>
Co-authored-by: Ralph Ursprung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants