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

DAOS-15288 client: Verify user/group for daos_cont_set_owner #14290

Merged
merged 15 commits into from
May 20, 2024

Conversation

kjacque
Copy link
Contributor

@kjacque kjacque commented May 1, 2024

  • Ensure the requested user/group exists before setting it.
  • Add a second API, daos_cont_set_owner_no_check(), for the case where the new owner/group can't be verified locally.
  • Modify daos_test to verify both check and no_check cases.
  • Add --no-check flag to daos cont set-owner.

Required-githooks: true

Features: container security

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate owners.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

- Ensure the requested user/group exists before setting it.
- Add a second API, daos_cont_set_owner_no_check(), for the case
  where the new owner/group can't be verified locally.
- Modify daos_test to verify both check and no_check cases.
- Add --no-check flag to daos cont set-owner.

Required-githooks: true

Features: container security

Signed-off-by: Kris Jacque <[email protected]>
@kjacque kjacque self-assigned this May 1, 2024
Copy link

github-actions bot commented May 1, 2024

Ticket title is 'DAOS contianer set-owner behaves differently between posix and non-posix containers'
Status is 'In Review'
Labels: 'scrubbed,triaged'
https://daosio.atlassian.net/browse/DAOS-15288

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14290/1/execution/node/1198/log

Features: container security

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14290/2/execution/node/1173/log

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-14290/3/testReport/

kjacque added 2 commits May 8, 2024 09:27
Also fix existing test to ensure user names are created on all
client nodes.

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14290/4/execution/node/1454/log

@kjacque kjacque marked this pull request as ready for review May 9, 2024 14:26
@kjacque kjacque requested review from a team as code owners May 9, 2024 14:26
@kjacque
Copy link
Contributor Author

kjacque commented May 9, 2024

Test failure is an existing issue on master: https://daosio.atlassian.net/issues/DAOS-15124

@kjacque kjacque requested review from mjmac, tanabarr and mchaarawi May 9, 2024 14:29
Copy link
Contributor

@daltonbohning daltonbohning left a comment

Choose a reason for hiding this comment

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

ftest LGTM

kjacque added 5 commits May 10, 2024 14:21
Features: container security

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
Features: container security

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage NLT on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com/job/daos-stack/job/daos/job/PR-14290/6/display/redirect

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14290/7/execution/node/1184/log

kjacque added 3 commits May 14, 2024 13:02
Features: container security

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
Features: container security
Allow-unstable-test: true
@daosbuild1
Copy link
Collaborator

Test stage Python Bandit check completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14290/14/execution/node/145/log

mchaarawi
mchaarawi previously approved these changes May 17, 2024
*
* \return 0 on success, errno code on failure.
*/
int
dfs_cont_set_owner(daos_handle_t coh, d_string_t user, d_string_t group);
dfs_cont_set_owner(daos_handle_t coh, d_string_t user, uid_t uid, d_string_t group, gid_t gid);
Copy link
Contributor

Choose a reason for hiding this comment

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

just a side comment for other reviewers, since this was added in master (not in 2.4.2) this is fine, no API breakage.

Comment on lines 1259 to 1270
static bool
is_uid_invalid(uid_t uid)
{
return uid == (uid_t)-1;
}

static bool
is_gid_invalid(gid_t gid)
{
return gid == (gid_t)-1;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

just curious why have a function call and not do the == in the if condition below directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it communicated more clearly what -1 indicated. Figured the compiler will end up inlining this anyway during optimization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just made a change to explicitly inline it.

src/tests/ftest/security/cont_owner.py Outdated Show resolved Hide resolved
src/tests/ftest/security/cont_owner.py Outdated Show resolved Hide resolved
src/tests/ftest/security/cont_owner.yaml Outdated Show resolved Hide resolved
src/tests/ftest/security/cont_owner.yaml Outdated Show resolved Hide resolved
kjacque added 2 commits May 17, 2024 17:24
Features: container security

Required-githooks: true

Signed-off-by: Kris Jacque <[email protected]>
Copy link
Contributor

@mjmac mjmac left a comment

Choose a reason for hiding this comment

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

Go changes LGTM.

Copy link
Contributor

@daltonbohning daltonbohning left a comment

Choose a reason for hiding this comment

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

ftest LGTM. Just nits. thanks for the updates!

Comment on lines +42 to +43
:avocado: tags=DaosContainerOwnerTest
:avocado: tags=test_container_set_owner_no_check_non_posix
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - it's preferred to put these on one line

Suggested change
:avocado: tags=DaosContainerOwnerTest
:avocado: tags=test_container_set_owner_no_check_non_posix
:avocado: tags=DaosContainerOwnerTest,test_container_set_owner_no_check_non_posix

Comment on lines +87 to +88
:avocado: tags=DaosContainerOwnerTest
:avocado: tags=test_container_set_owner_no_check_posix
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
:avocado: tags=DaosContainerOwnerTest
:avocado: tags=test_container_set_owner_no_check_posix
:avocado: tags=DaosContainerOwnerTest,test_container_set_owner_no_check_posix

@kjacque kjacque requested a review from a team May 20, 2024 15:49
@mchaarawi mchaarawi merged commit 2a9ea3a into master May 20, 2024
55 checks passed
@mchaarawi mchaarawi deleted the kjacque/validate-owner-uid branch May 20, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants