add restriction on users ability to set credentials#386
Open
JacobBarthelmeh wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the authentication manager’s “set credentials” operation so a non-admin user can only change their own credentials, while admins can change any user’s credentials. It does this by threading the caller’s user ID through the UserSetCredentials backend callback and enforcing the restriction in the default/base backend.
Changes:
- Extend
UserSetCredentialscallback API to includecurrent_user_id(caller) and pass it fromwh_Auth_UserSetCredentials. - Enforce self-only credential changes for non-admins in
wh_Auth_BaseUserSetCredentials(admins exempt). - Add documentation and a new test scenario for non-admin credential-change authorization.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfhsm/wh_auth.h | Updates callback signature to include current_user_id. |
| wolfhsm/wh_auth_base.h | Updates base backend API docs/signature to include caller ID and policy. |
| src/wh_auth.c | Passes context->user.user_id into backend UserSetCredentials callback. |
| src/wh_auth_base.c | Enforces “non-admin can only set own credentials” restriction. |
| test/wh_test_auth.c | Adds non-admin authorization test for set-credentials. |
| docs/src/chapter09.md | Documents the new restriction and clarifies action-bit vs backend authorization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #386
Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src
No new issues found in the changed files. ✅
acf8f9b to
9ec0bc8
Compare
9ec0bc8 to
b7503bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to item 3 from #270