Orbit passes EUA token during enrollment#43369
Conversation
There was a problem hiding this comment.
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.
f1fd907 to
29776ec
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for passing a Windows MDM end-user authentication (EUA) token from the Fleet MSI installer into Orbit, and sending it along with the /api/fleet/orbit/enroll request so Fleet can link the IdP account during enrollment.
Changes:
- Enable a new
EUA_TOKENMSI property (gated by Orbit version) and pass it to the Orbit Windows service as--eua-token. - Add a hidden
--eua-tokenCLI flag to Orbit and plumb it into the Orbit enroll request payload (eua_token). - Add unit tests covering both the MSI template output and the enroll request JSON behavior.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| orbit/pkg/packaging/windows.go | Enables the new MSI property based on Orbit version gating. |
| orbit/pkg/packaging/windows_templates.go | Adds EUA_TOKEN property and wires it into the Windows service arguments. |
| orbit/pkg/packaging/windows_eua_test.go | New tests validating the WiX template includes/omits EUA pieces appropriately. |
| orbit/pkg/packaging/packaging.go | Extends packaging Options with EnableEUATokenProperty. |
| orbit/cmd/orbit/orbit.go | Adds hidden --eua-token flag and sets it on the Orbit client before enrollment-triggering calls. |
| client/orbit_client.go | Stores EUA token on the client and includes it in EnrollOrbitRequest. |
| client/orbit_client_eua_test.go | Verifies eua_token is present when set and omitted when empty. |
| changes/41379-orbit-eua | Adds a changelog entry for the new behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #43369 +/- ##
==========================================
+ Coverage 66.90% 66.92% +0.01%
==========================================
Files 2596 2596
Lines 208220 208230 +10
Branches 9285 9321 +36
==========================================
+ Hits 139314 139350 +36
+ Misses 56236 56218 -18
+ Partials 12670 12662 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b249a9c to
049f089
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7f7d6f2 to
6e1a51e
Compare
getvictor
left a comment
There was a problem hiding this comment.
Looks good. Just some minor comments.
2d7853c to
264fe5b
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
4081172 to
a52da4a
Compare
WalkthroughThe PR adds EUA token support throughout Orbit's enrollment and Windows installer workflow. The Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
client/orbit_client.go (1)
512-525: Clear EUA token after successful enroll to preserve one-time semantics.
At Line 524, the token is sent on every enroll call for the process lifetime. Since this is intended to be one-time, clear it after a successful enroll response.♻️ Suggested change
func (oc *OrbitClient) enroll() (string, error) { verb, path := "POST", "/api/fleet/orbit/enroll" params := fleet.EnrollOrbitRequest{ EnrollSecret: oc.enrollSecret, HardwareUUID: oc.hostInfo.HardwareUUID, HardwareSerial: oc.hostInfo.HardwareSerial, Hostname: oc.hostInfo.Hostname, Platform: oc.hostInfo.Platform, PlatformLike: oc.hostInfo.PlatformLike, OsqueryIdentifier: oc.hostInfo.OsqueryIdentifier, ComputerName: oc.hostInfo.ComputerName, HardwareModel: oc.hostInfo.HardwareModel, EUAToken: oc.euaToken, } var resp fleet.EnrollOrbitResponse err := oc.request(verb, path, params, &resp) if err != nil { return "", err } + oc.euaToken = "" return resp.OrbitNodeKey, nil }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/orbit_client.go` around lines 512 - 525, The enroll() method currently sends oc.euaToken on every call; after a successful enroll response, clear the token to preserve one-time semantics by setting oc.euaToken = "" (in the OrbitClient instance) before returning success. Locate this in enroll() after the response is validated/parsed and ensure the token is cleared only on success (and consider using any existing client mutex if concurrent calls to enroll() are possible).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@client/orbit_client.go`:
- Around line 512-525: The enroll() method currently sends oc.euaToken on every
call; after a successful enroll response, clear the token to preserve one-time
semantics by setting oc.euaToken = "" (in the OrbitClient instance) before
returning success. Locate this in enroll() after the response is
validated/parsed and ensure the token is cleared only on success (and consider
using any existing client mutex if concurrent calls to enroll() are possible).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3f9ce1f7-dab2-4f1f-9e59-bcf8f8327c92
📒 Files selected for processing (8)
client/orbit_client.goclient/orbit_client_eua_test.goorbit/changes/41379-orbit-euaorbit/cmd/orbit/orbit.goorbit/pkg/packaging/packaging.goorbit/pkg/packaging/windows.goorbit/pkg/packaging/windows_eua_test.goorbit/pkg/packaging/windows_templates.go
|
@ksykulev I'm merging this so that I can built on top of these changes. |
Related issue: Resolves #41379
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
fleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changesSummary by CodeRabbit
New Features
--eua-tokenCLI flag for Windows MDM enrollmentTests
Documentation