Skip to content

don't send AccountConfiguration for non macs - #44085

Merged
MagnusHJensen merged 5 commits into
mainfrom
43228-dont-send-account-configuration-for-non-mac
Apr 24, 2026
Merged

don't send AccountConfiguration for non macs#44085
MagnusHJensen merged 5 commits into
mainfrom
43228-dont-send-account-configuration-for-non-mac

Conversation

@MagnusHJensen

@MagnusHJensen MagnusHJensen commented Apr 23, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #43228

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

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Bug Fixes

    • Account configuration commands for SSO and managed local admin setup are no longer sent to iOS and iPadOS devices when end-user authentication is enabled; these commands are restricted to macOS only.
  • Tests

    • Added an integration test ensuring AccountConfiguration is not enqueued for iOS/iPadOS enrollments when end-user authentication is enabled.

Copilot AI review requested due to automatic review settings April 23, 2026 20:27
@MagnusHJensen
MagnusHJensen requested a review from a team as a code owner April 23, 2026 20:27

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fb768123-0726-4a58-805e-bcb14579604c

📥 Commits

Reviewing files that changed from the base of the PR and between 00725fc and e0fbed1.

📒 Files selected for processing (1)
  • server/worker/apple_mdm.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/worker/apple_mdm.go

Walkthrough

The post-DEP enrollment flow was changed to only enqueue the AccountConfiguration MDM command for macOS devices. The code now checks the device platform before adding AccountConfiguration (previously added when SSO or managed local admin accounts were enabled regardless of platform). A worker integration test was added to confirm that AccountConfiguration is not enqueued for iOS/iPadOS enrollments when end-user SSO is enabled.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preventing AccountConfiguration from being sent to non-macOS devices, which is the core objective of this PR.
Description check ✅ Passed The description includes all required sections with the related issue (#43228), completed checklist items for changes file, security validations, testing, and manual QA. All necessary items are checked.
Linked Issues check ✅ Passed The PR successfully addresses issue #43228 by gating AccountConfiguration to macOS devices only. Code changes prevent sending the command to iOS/iPadOS, and tests validate this behavior, matching all stated objectives.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #43228: a changelog entry, platform check in MDM worker logic, and test coverage for iOS enrollment. No unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 43228-dont-send-account-configuration-for-non-mac

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 and usage tips.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
server/worker/apple_mdm_test.go (1)

827-839: Consider tightening the assertion.

Unlike the sibling macOS test (line 792) which uses ElementsMatch against the full expected command list, this test only checks NotContains "AccountConfiguration". Given the comment at lines 834–836 states no MDM commands should be enqueued for iOS here, an ElementsMatch(t, []string{}, cmdTypes) (or require.Empty(t, cmdTypes)) would more precisely pin the behavior and catch regressions that send other unintended commands to iOS.

Also, the queued release-device follow-up job mentioned in the comment isn't actually asserted — consider adding a ds.GetQueuedJobs check if that behavior is worth pinning, or remove the aside from the comment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/worker/apple_mdm_test.go` around lines 827 - 839, Tighten the test
assertion so it verifies no MDM commands are enqueued for iOS rather than only
asserting absence of "AccountConfiguration": replace the current
require.NotContains check on cmdTypes with require.Empty(t, cmdTypes) or
require.ElementsMatch(t, []string{}, cmdTypes) to assert an empty command list;
update the test around QueueAppleMDMJob / w.ProcessJobs and
getEnqueuedCommandTypes usage accordingly, and optionally either add a
ds.GetQueuedJobs assertion to pin the expected queued release-device follow-up
job or remove that aside from the comment.
changes/43228-dont-send-account-configuration-for-non-mac (1)

1-1: Minor: changelog phrasing is a bit awkward.

Consider tightening wording, e.g.: "Fixed an issue where an AccountConfiguration command (macOS-only) was incorrectly sent to iOS/iPadOS devices when end-user authentication was enabled."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@changes/43228-dont-send-account-configuration-for-non-mac` at line 1, Update
the changelog sentence to the tighter phrasing: replace the current line
describing the fix with: "Fixed an issue where an `AccountConfiguration` command
(macOS-only) was incorrectly sent to iOS/iPadOS devices when end-user
authentication was enabled." Locate the existing entry mentioning
AccountConfiguration and macOS only and swap the text exactly as suggested,
preserving the command name formatting and parentheses around "macOS-only."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@changes/43228-dont-send-account-configuration-for-non-mac`:
- Line 1: Update the changelog sentence to the tighter phrasing: replace the
current line describing the fix with: "Fixed an issue where an
`AccountConfiguration` command (macOS-only) was incorrectly sent to iOS/iPadOS
devices when end-user authentication was enabled." Locate the existing entry
mentioning AccountConfiguration and macOS only and swap the text exactly as
suggested, preserving the command name formatting and parentheses around
"macOS-only."

In `@server/worker/apple_mdm_test.go`:
- Around line 827-839: Tighten the test assertion so it verifies no MDM commands
are enqueued for iOS rather than only asserting absence of
"AccountConfiguration": replace the current require.NotContains check on
cmdTypes with require.Empty(t, cmdTypes) or require.ElementsMatch(t, []string{},
cmdTypes) to assert an empty command list; update the test around
QueueAppleMDMJob / w.ProcessJobs and getEnqueuedCommandTypes usage accordingly,
and optionally either add a ds.GetQueuedJobs assertion to pin the expected
queued release-device follow-up job or remove that aside from the comment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9865ff96-c0cf-4f86-831b-86cbfabcc63c

📥 Commits

Reviewing files that changed from the base of the PR and between d55b60d and e9735c2.

📒 Files selected for processing (3)
  • changes/43228-dont-send-account-configuration-for-non-mac
  • server/worker/apple_mdm.go
  • server/worker/apple_mdm_test.go

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

This PR fixes an Apple MDM enrollment issue where Fleet would enqueue the macOS-only AccountConfiguration command for iOS/iPadOS devices during ADE enrollment when end-user authentication (SSO) is enabled, leading to rejected-command errors.

Changes:

  • Gate AccountConfiguration enqueueing to macOS platforms only.
  • Add a regression test ensuring iOS enrollment with SSO enabled does not enqueue AccountConfiguration.
  • Add a changelog entry documenting the fix.

Reviewed changes

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

File Description
server/worker/apple_mdm.go Adds a macOS platform guard around AccountConfiguration enqueueing logic.
server/worker/apple_mdm_test.go Adds a test covering iOS ADE enrollment with SSO enabled to ensure AccountConfiguration is not enqueued.
changes/43228-dont-send-account-configuration-for-non-mac Documents the user-visible behavior fix in release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/worker/apple_mdm_test.go
Comment thread changes/43228-dont-send-account-configuration-for-non-mac Outdated
@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.76%. Comparing base (cc5fa22) to head (3e6e23c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44085      +/-   ##
==========================================
+ Coverage   63.40%   66.76%   +3.35%     
==========================================
  Files        2628     2623       -5     
  Lines      211127   211139      +12     
  Branches     9499     9270     -229     
==========================================
+ Hits       133856   140957    +7101     
+ Misses      64922    57355    -7567     
- Partials    12349    12827     +478     
Flag Coverage Δ
backend 68.53% <100.00%> (+3.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MagnusHJensen
MagnusHJensen merged commit 43e32d9 into main Apr 24, 2026
38 checks passed
@MagnusHJensen
MagnusHJensen deleted the 43228-dont-send-account-configuration-for-non-mac branch April 24, 2026 15:40
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.

Fleet sends macOS-only AccountConfiguration command to iPhones enrolled via ADE with SSO, causing a rejected command error

3 participants