Skip to content

✨ Add macOS FileVault, Gatekeeper, and SIP resources#7059

Merged
tas50 merged 2 commits intomainfrom
feat/macos-security-resources
Mar 28, 2026
Merged

✨ Add macOS FileVault, Gatekeeper, and SIP resources#7059
tas50 merged 2 commits intomainfrom
feat/macos-security-resources

Conversation

@tas50
Copy link
Copy Markdown
Member

@tas50 tas50 commented Mar 28, 2026

Summary

  • Adds macos.filevault resource for FileVault full-disk encryption status (fdesetup status)
    • enabled, status, hasPersonalRecoveryKey, hasInstitutionalRecoveryKey, users
  • Adds macos.gatekeeper resource for Gatekeeper app execution policy (spctl --status)
  • Adds macos.sip resource for System Integrity Protection status (csrutil status)

Each resource exposes enabled (bool) and status (string) as default fields, following the same patterns as existing macOS resources. All resources use Internal struct caching to avoid duplicate command execution and the command resource pattern for proper execution context.

Example usage

> macos.filevault
macos.filevault: macos.filevault enabled=true status="FileVault is On."
> macos.sip
macos.sip: macos.sip enabled=true status="System Integrity Protection status: enabled."
> macos.gatekeeper
macos.gatekeeper: macos.gatekeeper enabled=true status="assessments enabled"

Test plan

  • mql run local -c "macos.filevault" — verify FileVault status is reported
  • mql run local -c "macos.filevault { hasPersonalRecoveryKey hasInstitutionalRecoveryKey users }" — verify recovery key and user fields
  • mql run local -c "macos.gatekeeper" — verify Gatekeeper assessment status
  • mql run local -c "macos.sip" — verify SIP status
  • Verify on a macOS machine with FileVault enabled and disabled
  • Verify generated code is up-to-date (make mql/generate && git diff --exit-code)

🤖 Generated with Claude Code

Add three new macOS security resources to the OS provider for
compliance checking of core macOS security controls:

- macos.filevault: FileVault full-disk encryption status via fdesetup
- macos.gatekeeper: Gatekeeper app execution policy via spctl
- macos.sip: System Integrity Protection status via csrutil

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

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

Querying both enabled and status on any of the new macOS security resources will execute the underlying system command twice.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

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

Adding status to default fields will cause commands to execute twice per query due to unresolved caching issues.

@github-actions

This comment has been minimized.

@tas50 tas50 force-pushed the feat/macos-security-resources branch from c83fa37 to ea6a9ae Compare March 28, 2026 00:29
@mondoo-code-review mondoo-code-review bot dismissed their stale review March 28, 2026 00:30

Superseded by new review

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

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

New macOS FileVault, Gatekeeper, and SIP security resources for querying disk encryption, app execution policy, and system integrity status.

@tas50 tas50 force-pushed the feat/macos-security-resources branch from ea6a9ae to 6e2393f Compare March 28, 2026 00:33
Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

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

New macOS security resources work correctly for enabled systems but may error when FileVault is off.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

Test Results

5 741 tests  ±0   5 737 ✅ ±0   2m 4s ⏱️ -9s
  425 suites ±0       4 💤 ±0 
   33 files   ±0       0 ❌ ±0 

Results for commit e41ffed. ± Comparison against base commit a2d3027.

♻️ This comment has been updated with latest results.

- Use Internal struct caching to avoid double command execution
- Use command resource pattern instead of conn.RunCommand
- Use more specific SIP enabled check (status: enabled)
- Add filevault to spelling expect.txt
- Add hasPersonalRecoveryKey, hasInstitutionalRecoveryKey, users fields to filevault

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tas50 tas50 force-pushed the feat/macos-security-resources branch from 6e2393f to e41ffed Compare March 28, 2026 00:39
@tas50 tas50 merged commit 4c82ae0 into main Mar 28, 2026
23 checks passed
@tas50 tas50 deleted the feat/macos-security-resources branch March 28, 2026 00:44
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant