Repository navigation
feat(mdm): lock Windows hosts with BitLocker on Fleet Free CU-17tkuw6a8c2 - #296
Conversation
🦩 flamingo Code Review / security✅ No findings on the current head. Advisory: findings do not block the merge.
5 possible problems checked and ruled out, 4 after reading more of the repository
Review again. New commits are not reviewed until you ask:
Or comment Updated 2026-12-03 19:21 UTC · reviewed from Andrii Koropets's machine |
🦩 flamingo Code Review❌ Tests and checks failed on this commit: tests (go test). What each printed is in the Tests and mutation section. 6 findings: 🔴 0 action required · 🟠 0 recommended · 🔵 6 informational Advisory: findings do not block the merge. Checks:
🔵 Informational (6)
✅ What this change does well
Inline comments: 4 new · 1 already on this pull request from an earlier review (not posted again; the existing thread is linked below) Already commented on by an earlier review
Outside the lines this diff changes (no inline comment possible)
2 possible problems checked and ruled out, 1 after reading more of the repository
🧪 Tests and mutationTests per lane
Tests failed in .: what it printed lastChecks
The test services of flamingo-stack/fleetmdm (server/mdm/nanodep/storage/mysql/docker-compose-test.yml) did not come up: the integration tests may fail for that reason. The Go lane failed on this machine for the environment: go is not installed here (bash: go: command not found). The same packages were run in Docker golang:1.26.6 with MySQL 8.0.44 at this commit: the 4 new datastore tests and 13 new service tests pass; server/service and server/fleet pass except TestEmbeddedCleanupScriptMatchesDocs, and MySQL TestScripts, TestOpenframe*, TestMDMWindows, TestActiv. No mutation tool is configured for Go, so no mutation results. OpenGrep passed on the changed files. The PowerShell lock and unlock scripts are not run by any test here; they are checked by content only and not yet on a real Windows PC. 2 gaps (not tested here):
🤖 Prompt for AI agents: fix every findingNext: commit a suggestion, or hand a comment's prompt to your coding agent. React 👍 on a finding that helped and 👎 on one that is wrong: the reviewer learns from both. Review again. New commits are not reviewed until you ask:
Or comment Updated 2026-12-03 19:28 UTC · reviewed from Andrii Koropets's machine |
…lts, races and re-enrollment
…st the lock switches
Upstream locks Windows hosts on Premium only, by disabling local accounts. On Free in OpenFrame mode the fork locks them with BitLocker instead: the system drive is forced into recovery and the PC restarts to the BitLocker recovery screen, where it starts again only with the recovery key Fleet holds. Outside OpenFrame and shared mode, and for other platforms, the request goes to upstream as before.
Lock
POST /api/_version_/fleet/hosts/{id}/lock, with an optional body{"message": "..."}(up to 240 characters, no line breaks) that is set as the custom message of the recovery screen. The body stays optional: the request reads it itself, as the wipe does, so upstream's callers that send none are not refused.manage-bde -forcerecoveryand restarts the PC in 30 seconds. The message reaches the script in base64.Unlock
-forcerecoverydeleted (otherwise Windows asks for the key at every start) and restores the recovery message policy, without depending on fleetd or on Fleet's state of the host.failed_unlock.Scripts in OpenFrame mode
--enable-scripts. With that flag on, the fork refuses every script that isn't Fleet's own in OpenFrame and shared mode (422), so only the lock and unlock reach the PC.Activities
locked_hostwith the request,completed_lockorfailed_lock(with the exit code) with the result,unlocked_hostwith no user when the unlock succeeds,failed_unlock(with the exit code) when it fails for another reason than a PC that hasn't restarted.Callers and order
No caller yet. This Fleet image goes first. Then OpenFrame:
--enable-scriptsfor the agent, the SDK method with its README row, and the GraphQL contract fix (the lock in it still describes the accounts lock). No migration.Known limits
Tests
Two-tenant MySQL tests (
openframe_windows_lock_test.goin the datastore: the unlock schedule, concurrent locks, the script refusal) and service tests (openframe_windows_lock_test.go: the request body, the checks, the scripts, the activities).server/serviceandserver/fleetunit tests pass, exceptTestEmbeddedCleanupScriptMatchesDocs, which fails onmain, too: the docs copy it compares with is not in the fork. MySQLTestScripts,TestOpenframe*,TestMDMWindows,TestActivityandTestHostspass, exceptTestHosts/DeleteHosts, which fails onmain, too, onhost_software_windows_details.Details:
openframe/docs/windows-lock.md.Change-Set: windows-lock
Change set
flamingo-stack/fleetmdm#296: these pull requests are one change, reviewed together.Linked work
Linked by the
Depends-On/Change-Setlines in these descriptions; this block is maintained by the hub.