Add PSSO registration token#47948
Conversation
aaec5a9 to
5c66f19
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feature/fleet-macos-password-sync #47948 +/- ##
====================================================================
Coverage ? 67.09%
====================================================================
Files ? 3627
Lines ? 230299
Branches ? 11787
====================================================================
Hits ? 154518
Misses ? 61819
Partials ? 13962
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
This PR introduces a new Apple Platform SSO (PSSO) “device registration token” that’s delivered via configuration profile as a Fleet variable, expanded at MDM command-delivery time as a per-host Fleet-signed JWT, and then required/validated when the PSSO extension registers device keys.
Changes:
- Add
$FLEET_VAR_PSSO_DEVICE_REGISTRATION_TOKEN(Premium-only) with server-side validation that it only appears in the correct Platform SSO payload/key. - Implement host-secret expansion at MDM command delivery to mint and inject a per-host JWT registration token (never stored / not exposed via
/mdm/commands). - Require/validate
registration_tokenin the PSSO registration endpoint and update the macOS extension to send it.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/service/apple_psso.go | Decode registration_token from PSSO registration form body. |
| server/service/apple_mdm.go | Add PSSO reg token Fleet var support + placement validation for config profiles (Premium-gated). |
| server/service/apple_mdm_test.go | Add tests for PSSO variable placement and Premium gating. |
| server/mdm/nanomdm/service/nanomdm/service.go | Expand host-scoped secrets for “ProfileWithSecrets” commands at delivery time before signing/encoding. |
| server/mdm/apple/psso/regtoken/regtoken.go | New package to mint/validate Fleet-signed ES256 JWT registration tokens (aud-locked, sub=host UUID). |
| server/mdm/apple/psso/regtoken/regtoken_test.go | Unit tests for token mint/validate behavior and rejection cases. |
| server/mdm/apple/profile_processor.go | Replace PSSO Fleet var with a host-secret placeholder and short-circuit per-host fan-out when it’s the only variable. |
| server/mdm/apple/profile_processor_test.go | Tests covering placeholder substitution and fan-out behavior when mixed with other host vars. |
| server/fleet/secrets.go | Add new host secret type for PSSO device registration token. |
| server/fleet/mdm.go | Add Fleet variable constant + regexp for PSSO device registration token. |
| server/fleet/apple_psso.go | Add RegistrationToken field to PSSODeviceRegistrationRequest and document host identity derivation from it. |
| server/fleet/apple_profiles.go | Treat both org secrets and host secrets as requiring the “profile with secrets” command path. |
| server/datastore/mysql/secret_variables.go | Mint PSSO registration token from stored signing key asset during ExpandHostSecrets. |
| server/datastore/mysql/secret_variables_test.go | Test host secret expansion for PSSO registration token, including missing-asset failure. |
| server/datastore/mysql/schema.sql | Add fleet_variables seed row + bump auto-increments and migration status seed. |
| server/datastore/mysql/migrations/tables/20260619165649_AddPSSODeviceRegistrationTokenFleetVar.go | Migration to insert new fleet_variables row. |
| server/datastore/mysql/migrations/tables/20260619165649_AddPSSODeviceRegistrationTokenFleetVar_test.go | Migration test ensuring the variable is inserted. |
| ee/server/service/apple_psso.go | Validate registration token and derive host UUID from token subject during device registration. |
| ee/server/service/apple_psso_test.go | Tests for token-required registration and host identity derivation from token subject. |
| apps/fleet-desktop-macos/FleetPSSOExtension/AuthenticationViewController+Shared.swift | Add registration_token to the registration payload. |
| apps/fleet-desktop-macos/FleetPSSOExtension/AuthenticationViewController+PSSO.swift | Pass registration token from loginManager into registration POST. |
| apps/fleet-desktop-macos/fleet-sso-extension-example.mobileconfig | Example profile includes RegistrationToken set to the new Fleet var. |
| docs/Contributing/research/mdm/psso.md | Updated (content excluded from review). |
Files excluded by content exclusion policy (1)
- docs/Contributing/research/mdm/psso.md
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Related issue: Resolves #
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/oree/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
Where appropriate, automated tests simulate multiple hosts and test for host isolation (updates to one hosts's records do not affect another)
QA'd all new/changed functionality manually
For unreleased bug fixes in a release candidate, one of:
Database migrations
COLLATE utf8mb4_unicode_ci).New Fleet configuration settings
If you didn't check the box above, follow this checklist for GitOps-enabled settings:
fleetctl generate-gitopsfleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changes