opensearch-project / security

🔐 Secure your cluster with TLS, numerous authentication backends, data masking, audit logging as well as role-based access control on indices, documents, and fields
https://opensearch.org/docs/latest/security-plugin/index/
Apache License 2.0
180 stars 264 forks source link

Refactor Roles REST API test and partial fix #4166 #4433

Closed willyborankin closed 1 week ago

willyborankin commented 3 weeks ago

Description

Refactor Roles REST API test

Issues Resolved

partial fix #4166

Check List

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.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 65.23%. Comparing base (439606c) to head (a88c04e).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opensearch-project/security/pull/4433/graphs/tree.svg?width=650&height=150&src=pr&token=rBpySfQXMt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)](https://app.codecov.io/gh/opensearch-project/security/pull/4433?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) ```diff @@ Coverage Diff @@ ## main #4433 +/- ## ========================================== - Coverage 65.24% 65.23% -0.01% ========================================== Files 312 312 Lines 22032 22032 Branches 3558 3558 ========================================== - Hits 14374 14372 -2 - Misses 5888 5890 +2 Partials 1770 1770 ``` | [Files](https://app.codecov.io/gh/opensearch-project/security/pull/4433?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [...nsearch/security/dlic/rest/api/RolesApiAction.java](https://app.codecov.io/gh/opensearch-project/security/pull/4433?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fopensearch%2Fsecurity%2Fdlic%2Frest%2Fapi%2FRolesApiAction.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-c3JjL21haW4vamF2YS9vcmcvb3BlbnNlYXJjaC9zZWN1cml0eS9kbGljL3Jlc3QvYXBpL1JvbGVzQXBpQWN0aW9uLmphdmE=) | `98.03% <100.00%> (+0.08%)` | :arrow_up: | | [...g/opensearch/security/dlic/rest/support/Utils.java](https://app.codecov.io/gh/opensearch-project/security/pull/4433?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fopensearch%2Fsecurity%2Fdlic%2Frest%2Fsupport%2FUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-c3JjL21haW4vamF2YS9vcmcvb3BlbnNlYXJjaC9zZWN1cml0eS9kbGljL3Jlc3Qvc3VwcG9ydC9VdGlscy5qYXZh) | `59.45% <100.00%> (-1.07%)` | :arrow_down: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/security/pull/4433/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
willyborankin commented 2 weeks ago

@willyborankin I see some overlap with #4450. Should we combine these into 1 PR?

@DarshitChanpura, Yes I tested https://github.com/opensearch-project/security/pull/4450 with internal-test fixes I added in this PR. So this one should be merged first.

opensearch-trigger-bot[bot] commented 1 week ago

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

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-4433-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 962eafab80fac3064de02b76bc956ee031703e0e
# Push it to GitHub
git push --set-upstream origin backport/backport-4433-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 base branch is 2.x and the compare/head branch is backport/backport-4433-to-2.x.