Rotate recovery lock password - #41833
Merged
Merged
Conversation
For the following quick win: - #40354
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for rotating a macOS host’s Apple MDM recovery lock password by introducing a new authenticated API endpoint, MDM command + secret expansion support for the “pending” password, and datastore/schema changes to track and finalize rotation.
Changes:
- Add
POST /fleet/hosts/{id}/recovery_lock_password/rotateendpoint andfleet.Service.RotateRecoveryLockPasswordAPI. - Implement rotation state in MySQL (
pending_encrypted_password,pending_error_message) plus datastore helpers and result-handler logic to complete/fail rotation. - Add Apple MDM commander support for
SetRecoveryLockrotation (CurrentPassword + NewPassword placeholders) and a new activity type for audit logging.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/service/hosts.go | Adds rotate endpoint wiring + Free-tier stub implementation (license-gated). |
| server/service/handler.go | Registers the new authenticated route for rotation. |
| server/service/apple_mdm.go | Extends SetRecoveryLock results handler to detect/handle rotations. |
| server/service/apple_mdm_cmd_results_test.go | Updates existing tests to stub the new rotation check (no new rotation cases). |
| server/mock/service/service_mock.go | Extends service mock with RotateRecoveryLockPassword hook. |
| server/mock/datastore_mock.go | Extends datastore mock with rotation-related methods. |
| server/mdm/apple/commander.go | Adds RotateRecoveryLock command payload using secret placeholders. |
| server/fleet/service.go | Extends Service interface with RotateRecoveryLockPassword. |
| server/fleet/secrets.go | Adds a host secret type for pending recovery lock password expansion. |
| server/fleet/datastore.go | Extends Datastore interface with rotation lifecycle methods. |
| server/fleet/apple_mdm.go | Extends Apple command issuer interface + adds rotation status struct. |
| server/fleet/activities.go | Adds new activity type for recovery lock password rotation. |
| server/datastore/mysql/secret_variables.go | Supports decrypt/expand of pending recovery lock password secret. |
| server/datastore/mysql/schema.sql | Adds pending rotation columns to host_recovery_key_passwords and bumps migration id. |
| server/datastore/mysql/migrations/tables/20260317120000_AddRecoveryLockPasswordRotation.go | Migration to add pending rotation columns. |
| server/datastore/mysql/apple_mdm.go | Implements rotation datastore methods and status queries. |
| server/datastore/mysql/apple_mdm_test.go | Adds datastore-level tests for rotation lifecycle. |
| ee/server/service/hosts.go | Implements the EE RotateRecoveryLockPassword workflow (validation, enqueue, activity). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
getvictor
previously approved these changes
Mar 17, 2026
getvictor
left a comment
Member
There was a problem hiding this comment.
Looks good. Please review any remaining AI agent comments.
getvictor
previously approved these changes
Mar 17, 2026
# Conflicts: # server/datastore/mysql/apple_mdm_test.go
Contributor
Author
|
@getvictor fixed a merge conflict |
getvictor
approved these changes
Mar 17, 2026
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.
Related issue: Resolves #39782
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirectsTesting
Added/updated automated tests
QA'd all new/changed functionality manually
Database migrations
COLLATE utf8mb4_unicode_ci).Summary by CodeRabbit
New Features