Skip to content

Orbit passes EUA token during enrollment#43369

Open
ksykulev wants to merge 4 commits into41381-eua-ms-installerfrom
41379-eua-orbit
Open

Orbit passes EUA token during enrollment#43369
ksykulev wants to merge 4 commits into41381-eua-ms-installerfrom
41379-eua-orbit

Conversation

@ksykulev
Copy link
Copy Markdown
Contributor

@ksykulev ksykulev commented Apr 9, 2026

Related issue: Resolves #41379

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.

Testing

fleetd/orbit/Fleet Desktop

  • Verified compatibility with the latest released version of Fleet (see Must rule)
  • If the change applies to only one platform, confirmed that runtime.GOOS is used as needed to isolate changes
  • Verified that fleetd runs on macOS, Linux and Windows
  • Verified auto-update works from the released version of component to the new version (see tools/tuf/test)

@ksykulev ksykulev requested a review from a team as a code owner April 9, 2026 20:20
Copy link
Copy Markdown

@claude claude bot left a comment

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.

@ksykulev ksykulev requested review from Copilot and removed request for a team April 9, 2026 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_TOKEN MSI property (gated by Orbit version) and pass it to the Orbit Windows service as --eua-token.
  • Add a hidden --eua-token CLI 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
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.84%. Comparing base (16e696e) to head (6e1a51e).

Files with missing lines Patch % Lines
orbit/cmd/orbit/orbit.go 0.00% 8 Missing ⚠️
orbit/pkg/packaging/windows.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           41381-eua-ms-installer   #43369      +/-   ##
==========================================================
- Coverage                   66.88%   66.84%   -0.04%     
==========================================================
  Files                        2594     2588       -6     
  Lines                      207936   207536     -400     
  Branches                     9207     9207              
==========================================================
- Hits                       139080   138732     -348     
+ Misses                      56200    56184      -16     
+ Partials                    12656    12620      -36     
Flag Coverage Δ
backend 68.63% <0.00%> (-0.05%) ⬇️

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

@getvictor getvictor left a comment

Choose a reason for hiding this comment

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

Looks good. Just some minor comments.

Comment on lines +24 to +34
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := io.ReadAll(r.Body)
assert.NoError(t, err)
assert.NoError(t, json.Unmarshal(body, &receivedBody))

resp := fleet.EnrollOrbitResponse{OrbitNodeKey: testNodeKey}
w.Header().Set("Content-Type", "application/json")
err = json.NewEncoder(w).Encode(resp)
assert.NoError(t, err)
}))
defer srv.Close()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit. This setup is the same in both subtests. Can this be table-driven?

Comment on lines +86 to +95
func TestSetEUAToken(t *testing.T) {
oc := &OrbitClient{}
require.Empty(t, oc.euaToken)

oc.SetEUAToken("some-token")
require.Equal(t, "some-token", oc.euaToken)

oc.SetEUAToken("")
require.Empty(t, oc.euaToken)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit. This is already covered by the test above.

@@ -0,0 +1 @@
* Orbit passes EUA token during enrollment request No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be in orbit/changes/ directory

Comment on lines +49 to +64
t.Run("EUA_TOKEN flag appears in ServiceInstall Arguments", func(t *testing.T) {
opt := baseOpt
opt.EnableEUATokenProperty = true

var buf bytes.Buffer
err := windowsWixTemplate.Execute(&buf, opt)
require.NoError(t, err)

// Find the ServiceInstall Arguments line and verify eua-token is in it.
for line := range strings.SplitSeq(buf.String(), "\n") {
if strings.Contains(line, "Arguments=") && strings.Contains(line, "--fleet-url") {
assert.Contains(t, line, `--eua-token="[EUA_TOKEN]"`,
"eua-token flag should be in ServiceInstall Arguments")
return
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit. This could be merged with test 1.

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.

3 participants