View recovery password: fix permissions - #41951
Conversation
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
Adjusts server-side authorization for viewing macOS Recovery Lock passwords so it matches standard host read access, and adds tests to validate the updated permission behavior.
Changes:
- Update
GetHostRecoveryLockPasswordauthorization fromfleet.ActionWritetofleet.ActionRead. - Add an authorization matrix test covering allowed/disallowed users for global vs team hosts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/service/hosts.go | Loosens/aligns the authz check for viewing recovery lock passwords to use host read permissions. |
| server/service/hosts_test.go | Adds tests to verify authorization behavior for viewing recovery lock passwords across user roles and host scoping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
WalkthroughThis pull request modifies the authorization check for GetHostRecoveryLockPassword from requiring ActionWrite to ActionRead permissions. The change aligns read access for recovery lock passwords with the existing read permissions for accessing hosts. Additionally, a new test function is added to validate authorization behavior across different host contexts and user roles, ensuring that the updated permission check is enforced correctly. Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
| }) | ||
| } | ||
|
|
||
| func TestGetHostRecoveryLockPasswordAuth(t *testing.T) { |
There was a problem hiding this comment.
Nit. I think this is overkill for testing just to make sure we passed the right arguments to authz.Authorize
There was a problem hiding this comment.
you think it's better handled in integration tests?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #41951 +/- ##
==========================================
+ Coverage 66.40% 66.42% +0.01%
==========================================
Files 2510 2510
Lines 201184 201372 +188
Branches 9058 9058
==========================================
+ Hits 133594 133756 +162
- Misses 55517 55529 +12
- Partials 12073 12087 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Related issue: Resolves #41975
Existing permissions to view passwords are too restrictive
Testing
For unreleased bug fixes in a release candidate, one of:
Summary by CodeRabbit
Bug Fixes
Tests