Skip to content

51260 Derive disk encryption status from per-platform flags - #51981

Draft
JordanMontgomery wants to merge 1 commit into
mainfrom
51260-de-status-derivation
Draft

51260 Derive disk encryption status from per-platform flags#51981
JordanMontgomery wants to merge 1 commit into
mainfrom
51260-de-status-derivation

Conversation

@JordanMontgomery

@JordanMontgomery JordanMontgomery commented Aug 26, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #51260

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.

  • Timeouts are implemented and retries are limited to avoid infinite loops

  • If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes

Testing

Minimal manual testing but simulated by updating hdek rows in the DB to verify that e.g. in enforce-only mode it no longer blocks on a non-decryptable or nonexistent key

  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • New Features

    • FileVault status now supports enforcement-only configurations without requiring recovery-key escrow.
    • Enforcement-only status reflects the reported disk-encryption state, while escrow-enabled configurations continue to use recovery-key status.
    • Host details, summaries, and filters now consistently reflect the selected FileVault enforcement mode.
    • Added appropriate actions for each state, including verification, key rotation, and logout prompts.
  • Bug Fixes

    • Corrected macOS disk-encryption status and filtering across host views and MDM summaries.

@JordanMontgomery

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cf417ab5-02ad-4a98-936c-e532b0940663

📥 Commits

Reviewing files that changed from the base of the PR and between 9ca6377 and 66f7ee4.

📒 Files selected for processing (11)
  • server/datastore/mysql/apple_mdm.go
  • server/datastore/mysql/apple_mdm_test.go
  • server/datastore/mysql/hosts.go
  • server/datastore/mysql/labels.go
  • server/fleet/app.go
  • server/fleet/hosts.go
  • server/fleet/hosts_test.go
  • server/service/apple_mdm_test.go
  • server/service/hosts.go
  • server/service/hosts_test.go
  • server/service/integration_mdm_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

macOS FileVault status derivation now accepts disk-encryption configuration and reported disk state. Enforcement-only configurations use disk state; other configurations use escrowed-key state. Datastore summaries and host filters use the same mode-specific predicates and join host_disks when required. Host-detail aggregation loads team configuration and passes it to status derivation. Unit, datastore, service, and integration tests cover status matrices, summaries, filters, and status transitions.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes address macOS enforce-only and escrow-only derivation, summaries, filters, profile handling, and automated coverage. The provided changes do not show implementation of the linked issue's r… Implement and test the Windows and Linux platform-setting changes required by #51260. Update platform summaries, filters, and per-host status logic to use their respective settings, and ensure disabled platforms produce empty aggregates as …
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 9 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changed production files and tests are focused on disk-encryption status derivation, summaries, filters, host details, and related integration coverage. No unrelated code changes are evident.
Title check ✅ Passed The title clearly and concisely describes the primary change: deriving disk-encryption status from per-platform flags.
Description check ✅ Passed The description includes the related issue, relevant checklist confirmations, automated testing, host-isolation testing, and manual QA details. The changes-file checkbox is left unchecked, but the des…
Full details: Linked Issues check

Explanation

The changes address macOS enforce-only and escrow-only derivation, summaries, filters, profile handling, and automated coverage. The provided changes do not show implementation of the linked issue's required Windows/Linux setting-based summary and status updates, or platform-gated aggregate summaries.

Resolution

Implement and test the Windows and Linux platform-setting changes required by #51260. Update platform summaries, filters, and per-host status logic to use their respective settings, and ensure disabled platforms produce empty aggregates as specified.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 9 files. (2 skipped: 2 too large.)

Full details: Description check

Explanation

The description includes the related issue, relevant checklist confirmations, automated testing, host-isolation testing, and manual QA details. The changes-file checkbox is left unchecked, but the description is otherwise sufficiently complete and relevant.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 51260-de-status-derivation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates macOS FileVault status derivation to use escrow-key state or reported disk state based on platform settings.

Changes:

  • Adds configuration-aware Go and SQL status derivation.
  • Updates summaries and host filters.
  • Adds unit, datastore, service, and integration coverage.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/fleet/app.go Adds enforce-only configuration helper.
server/fleet/hosts.go Derives FileVault status from key or disk state.
server/fleet/hosts_test.go Adds derivation matrix tests.
server/service/hosts.go Loads effective host encryption configuration.
server/service/hosts_test.go Tests per-platform host details.
server/service/apple_mdm_test.go Updates datastore mocks.
server/service/integration_mdm_test.go Tests escrow-only and enforce-only flows.
server/datastore/mysql/apple_mdm.go Updates SQL predicates and summaries.
server/datastore/mysql/apple_mdm_test.go Adds SQL behavior matrix coverage.
server/datastore/mysql/hosts.go Updates host-list filters.
server/datastore/mysql/labels.go Updates label host filters.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server/fleet/hosts.go
Comment on lines +1001 to +1005
verification := d.keyVerification()
// logging out lets the deferred FileVault enablement run; rotating
// produces a key Fleet can escrow
actionRequired := ActionRequiredRotateKey
if cfg.MacOSEnforceOnly() {
Comment on lines +3282 to +3286
func fileVaultVerificationPredicates(enforceOnly bool) (confirmed, notConfirmed, unknown string) {
if enforceOnly {
return `hd.encrypted = 1`, `hd.encrypted = 0`, `hd.encrypted IS NULL`
}
return `hdek.decryptable = 1`,
return []fleet.HostMDMAppleProfile{*c.fvProf}, nil
}

hostDetail, err := svc.getHostDetails(test.UserContext(context.Background(), test.UserAdmin), host, fleet.HostDetailOptions{})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Filevault/EScrow: host status derivation and summaries

2 participants