Skip to content

Victor 48723 windows mla fleetd - #50087

Closed
getvictor wants to merge 33 commits into
mainfrom
victor-48723-windows-mla-fleetd
Closed

Victor 48723 windows mla fleetd#50087
getvictor wants to merge 33 commits into
mainfrom
victor-48723-windows-mla-fleetd

Conversation

@getvictor

@getvictor getvictor commented Jul 28, 2026

Copy link
Copy Markdown
Member

Related issue:

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

For unreleased bug fixes in a release candidate, one of:

  • Confirmed that the fix is not expected to adversely impact load test results
  • Alerted the release DRI if additional load testing is needed

Database migrations

  • Checked schema for all modified table for columns that will auto-update timestamps during migration.
  • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
  • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).

New Fleet configuration settings

  • Setting(s) is/are explicitly excluded from GitOps

If you didn't check the box above, follow this checklist for GitOps-enabled settings:

  • Verified that the setting is exported via fleetctl generate-gitops
  • Verified the setting is documented in a separate PR to the GitOps documentation
  • Verified that the setting is cleared on the server if it is not supplied in a YAML file (or that it is documented as being optional)
  • Verified that any relevant UI is disabled when GitOps mode is enabled

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)

Summary by CodeRabbit

  • New Features

    • Windows hosts can now receive a hidden Fleet-managed local administrator account.
    • The account password is securely escrowed, with device errors reported when provisioning fails.
    • Fleet displays managed account status, password availability, and device-reported error details.
    • Windows account creation is gated by licensing, configuration, device capability, and enrollment state.
  • Bug Fixes

    • Windows managed account passwords are excluded from automatic rotation workflows.

getvictor added 30 commits July 23, 2026 20:57
Adds the server half of the Windows managed local admin account device flow:
the orbit notification that tells fleetd to create the account, the orbit
escrow endpoint that stores the device-generated password, and the host-facing
endpoint changes that let admins retrieve a Windows password.

- Migration: make host_managed_local_account_passwords.command_uuid nullable
  (Windows rows have no MDM command).
- Capability windows_managed_local_account, advertised by Windows fleetd.
- Notification create_windows_managed_local_account, gated on ESP phase, the
  team/No-team setting, the capability, and premium license.
- Escrow endpoint POST /api/fleet/orbit/managed_local_account: verifies the
  host's Windows MDM enrollment, stores the password (verified, NULL
  command_uuid), and logs the created activity. Per OpenSpec it does not reject
  when the setting/license changed after the notification, to avoid orphaning
  the on-device account.
- Host endpoints: retrieval and detail response support Windows without arming
  the auto-rotate timer; rotation stays macOS-only.
…8721-windows-mla-server

# Conflicts:
#	server/datastore/mysql/schema.sql
Copilot AI review requested due to automatic review settings July 28, 2026 19:53
@getvictor

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@getvictor

Copy link
Copy Markdown
Member Author

/agentic_review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 28, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Existing accounts remain unusable ✓ Resolved 🐞 Bug ≡ Correctness
Description
When _fleetadmin already exists, ensureUser resets only its password and does not enable the
account or restore the non-expiring-password flags applied during creation. Fleet can consequently
mark and escrow the account as verified even though the break-glass credentials cannot be used.
Code

orbit/pkg/managedaccount/managedaccount_windows.go[R95-100]

+	if exists {
+		info := userInfo1003{Password: passwordPtr}
+		ret, _, _ := procNetUserSetInfo.Call(
+			0, // servername: NULL means the local machine
+			uintptr(unsafe.Pointer(namePtr)),
+			userInfoPasswordOnly,
Evidence
The existing-user branch uses password-only update level 1003 and immediately returns success. In
contrast, the creation branch applies ufNormalAccount and ufDontExpirePasswd, which the file
itself documents as necessary for a usable break-glass login, and the caller escrows every
successful provisioning result.

orbit/pkg/managedaccount/managedaccount_windows.go[14-25]
orbit/pkg/managedaccount/managedaccount_windows.go[78-120]
orbit/pkg/managedaccount/managedaccount.go[115-132]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Provisioning an existing `_fleetadmin` account updates only its password, leaving disabled or expiring account state unchanged even though the password is subsequently escrowed as verified.
## Issue Context
Query and repair the existing account's flags on every provisioning run. Ensure the account is enabled, remains a normal account, and has password expiration disabled without unintentionally discarding unrelated required flags; add Windows-focused tests for disabled and expiring existing accounts.
## Fix Focus Areas
- orbit/pkg/managedaccount/managedaccount_windows.go[14-25]
- orbit/pkg/managedaccount/managedaccount_windows.go[78-120]
- orbit/pkg/managedaccount/managedaccount.go[115-132]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Windows account UI unreachable 🐞 Bug ≡ Correctness
Description
The backend now supports retrieving Windows managed-account passwords, but the host UI removes the
action for every non-macOS platform and omits managed-account status from Windows OS settings.
Administrators therefore cannot retrieve the Windows password or inspect provisioning failures
through the normal UI.
Code

ee/server/service/hosts.go[R760-761]

+	isWindows := fleet.IsWindowsPlatform(host.Platform)
+	if !fleet.IsMacOSPlatform(host.Platform) && !isWindows {
Evidence
The changed service explicitly admits Windows hosts and populates their managed-account status, but
the frontend helper returns false whenever the platform is not darwin, after which the action is
removed. The Windows OS-settings builder only adds profiles and disk-encryption rows, while
HostDetailsPage passes the macOS setting and would expose the rotation control without a Windows
platform guard.

ee/server/service/hosts.go[747-808]
server/service/hosts.go[1790-1792]
frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx[394-415]
frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx[562-564]
frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsTableConfig.tsx[149-172]
frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx[1101-1109]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The backend now exposes Windows managed-account status and password retrieval, but the host UI still restricts the managed-account action to macOS and does not render its status for Windows hosts.
## Issue Context
Use the Windows managed-local-account setting when building host actions, allow eligible Windows MDM hosts to open the managed-account modal, suppress unsupported password rotation on Windows, and render the Windows status/detail in OS settings.
## Fix Focus Areas
- ee/server/service/hosts.go[760-761]
- frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx[394-415]
- frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx[1101-1109]
- frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx[1822-1830]
- frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsTableConfig.tsx[149-172]
- frontend/interfaces/host.ts[140-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread ee/server/service/hosts.go
Comment on lines +95 to +100
if exists {
info := userInfo1003{Password: passwordPtr}
ret, _, _ := procNetUserSetInfo.Call(
0, // servername: NULL means the local machine
uintptr(unsafe.Pointer(namePtr)),
userInfoPasswordOnly,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Existing accounts remain unusable 🐞 Bug ≡ Correctness

When _fleetadmin already exists, ensureUser resets only its password and does not enable the
account or restore the non-expiring-password flags applied during creation. Fleet can consequently
mark and escrow the account as verified even though the break-glass credentials cannot be used.
Agent Prompt
## Issue description
Provisioning an existing `_fleetadmin` account updates only its password, leaving disabled or expiring account state unchanged even though the password is subsequently escrowed as verified.

## Issue Context
Query and repair the existing account's flags on every provisioning run. Ensure the account is enabled, remains a normal account, and has password expiration disabled without unintentionally discarding unrelated required flags; add Windows-focused tests for disabled and expiring existing accounts.

## Fix Focus Areas
- orbit/pkg/managedaccount/managedaccount_windows.go[14-25]
- orbit/pkg/managedaccount/managedaccount_windows.go[78-120]
- orbit/pkg/managedaccount/managedaccount.go[115-132]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Adds end-to-end support for Windows “managed local admin account” provisioning/escrow, spanning server notification gating, a new Orbit escrow endpoint, datastore persistence, and a new Windows-only fleetd (Orbit) receiver that creates/hides the _fleetadmin account and reports success/failure back to Fleet.

Changes:

  • Server: gates and emits create_windows_managed_local_account in Orbit config for premium + capable Windows MDM hosts until per-enrollment escrow is completed.
  • Server: adds /api/fleet/orbit/managed_local_account endpoint to accept password escrow or client_error, persists status/detail, and logs a one-time “created managed local account” activity.
  • Orbit (fleetd): introduces orbit/pkg/managedaccount receiver to generate a compliant password, provision/hide the account on Windows, and escrow/report errors.

Reviewed changes

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

Show a summary per file
File Description
server/service/orbit.go Adds notification gating, team/no-team setting resolution, and new escrow endpoint handler + service method.
server/service/orbit_test.go Adds unit coverage for notification gating and escrow endpoint behavior (validation, truncation, activity).
server/service/hosts.go Factors and reuses managed local account status population for host details (Windows + macOS paths).
server/service/hosts_test.go Ensures Windows host details surface managed local account status.
server/service/handler.go Registers the new Orbit escrow route under Windows MDM middleware.
server/mock/service/service_mock.go Extends service mock with EscrowWindowsManagedLocalAccountPassword.
server/mock/datastore_mock.go Extends datastore mock with escrow save/error + per-enrollment flag setter.
server/fleet/service.go Adds EscrowWindowsManagedLocalAccountPassword to the service interface.
server/fleet/orbit.go Adds CreateWindowsManagedLocalAccount Orbit config notification field.
server/fleet/microsoft_mdm.go Extends Windows host config state with ManagedLocalAccountEscrowed flag.
server/fleet/hosts.go Adds IsWindowsPlatform helper; moves/defines ManagedLocalAccountUsername + adds status detail field.
server/fleet/datastore.go Adds datastore APIs for Windows escrow save/error + per-enrollment escrowed flag.
server/fleet/capabilities.go Advertises CapabilityWindowsManagedLocalAccount from Windows fleetd capability set.
server/fleet/apple_mdm.go Removes ManagedLocalAccountUsername from Apple-only file (now platform-neutral).
server/fleet/api_orbit.go Defines Orbit request/response types for managed local account escrow.
server/datastore/mysql/schema.sql Updates schema for nullable command_uuid/encrypted_password, adds client_error + managed_local_account_escrowed.
server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns.go Migration adding columns + relaxing nullability.
server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns_test.go Verifies migration works against populated tables and defaults are correct.
server/datastore/mysql/microsoft_mdm.go Implements SetMDMWindowsManagedLocalAccountEscrowed + extends config-state query.
server/datastore/mysql/microsoft_mdm_test.go Ensures per-enrollment escrow flag does not survive re-enrollment while password does.
server/datastore/mysql/managed_local_account.go Adds escrow save + error reporting; treats NULL password as not-found; surfaces client_error as detail.
server/datastore/mysql/managed_local_account_test.go Adds escrow lifecycle tests (save, retry, error, recovery, error-only row).
pkg/str/str.go Adds TruncateRunes helper for rune-safe truncation prior to DB storage.
pkg/str/str_test.go Adds tests for TruncateRunes behavior with ASCII and multi-byte input.
orbit/pkg/managedaccount/managedaccount.go New receiver: single-flight guarded background create+escrow flow + password generator.
orbit/pkg/managedaccount/managedaccount_windows.go Windows implementation using netapi32 + registry to create/reset user, add to Administrators, hide from sign-in.
orbit/pkg/managedaccount/managedaccount_stub.go Non-Windows stub to prevent unsupported invocation.
orbit/pkg/managedaccount/managedaccount_test.go Unit tests for receiver behavior, retry semantics, single-flight, and password complexity.
orbit/cmd/orbit/orbit.go Registers the managedaccount receiver in the Windows orbitAction path.
orbit/changes/48723-windows-managed-local-account Adds Orbit changelog entry for Windows managed local account support.
ee/server/service/hosts.go Extends managed account password endpoint to allow Windows and blocks rotation for Windows.
client/orbit_client.go Adds client method to POST the managed local account password/client_error to the server.

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

Comment thread pkg/str/str.go
Comment thread server/service/orbit.go
Comment on lines +1603 to +1605
if len(password) > managedLocalAccountMaxPasswordLength {
return &fleet.BadRequestError{Message: "managed local account password is too long"}
}
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds Windows managed local account support across Orbit and the server. Orbit advertises a capability, receives configuration notifications, creates or updates and hides _fleetadmin, generates secure passwords, and escrows results. The server adds escrow endpoints, validation, persistence, enrollment state tracking, client-error reporting, host-detail status, and Windows-specific non-rotation behavior. Database migrations, schemas, tests, mocks, and a change note are included.

Possibly related issues

  • fleetdm/fleet issue 43488: Covers the Windows hidden local administrator creation, Orbit integration, and password escrow implemented here.

Possibly related PRs

  • fleetdm/fleet#49863: Wires the managed local account setting consumed by this PR’s Orbit configuration logic.
  • fleetdm/fleet#49924: Overlaps with the server-side managed local account escrow, status, and rotation changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.89% 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 is concise and still clearly points to the Windows managed local account fleetd work.
Description check ✅ Passed The description includes the required related issue and the repository checklist sections in the expected template.
Linked Issues check ✅ Passed The changes implement the Windows managed local account receiver, escrow flow, capability, and related server contract expected by #48723.
Out of Scope Changes check ✅ Passed The diff stays focused on the managed local account feature and its supporting tests, schema, and wiring.
✨ 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 victor-48723-windows-mla-fleetd

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.

@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 (3)
server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns_test.go (1)

11-48: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for the actual nullability change.

The test validates that pre-existing non-NULL data survives the migration, but never asserts that encrypted_password/command_uuid can be NULL post-migration — which is the behavior this migration exists to enable. A regression here (e.g., a stray NOT NULL left on either column) wouldn't be caught.

♻️ Suggested addition after line 47
_, err = db.Exec(`
    INSERT INTO host_managed_local_account_passwords (host_uuid, encrypted_password, command_uuid, status)
    VALUES (?, NULL, NULL, ?)`, "new-host-null-cols", "pending")
require.NoError(t, err, "encrypted_password and command_uuid should now accept NULL")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns_test.go`
around lines 11 - 48, Extend TestUp_20260728171642 to insert a new pending row
into host_managed_local_account_passwords with both encrypted_password and
command_uuid set to NULL after applyNext. Assert the insert succeeds, preserving
the existing checks for migrated non-NULL data and enrollment defaults.
orbit/pkg/managedaccount/managedaccount_windows.go (1)

80-131: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Password-reset path doesn't re-affirm account flags.

ensureUser's existing-account branch only resets the password (USER_INFO_1003, password-only level). It never re-applies ufDontExpirePasswd/ufNormalAccount, unlike addToAdministrators and hideFromSignInScreen, which are unconditionally reapplied on every run. If those flags are ever cleared out-of-band (GPO, admin edit, account disabled), a retry through this idempotent path silently leaves the account in a degraded state instead of self-healing it.

Consider setting flags via a USER_INFO_1008 (flags-only) call, or re-running the full USER_INFO_1 update, on the reset branch too, to match the "every step is idempotent" invariant documented above provisionAccount.

♻️ Suggested fix: also reaffirm account flags on the reset branch
 	if exists {
-		info := userInfo1003{Password: passwordPtr}
-		ret, _, _ := procNetUserSetInfo.Call(
+		pwInfo := userInfo1003{Password: passwordPtr}
+		ret, _, _ := procNetUserSetInfo.Call(
 			0, // servername: NULL means the local machine
 			uintptr(unsafe.Pointer(namePtr)),
 			userInfoPasswordOnly,
-			uintptr(unsafe.Pointer(&info)),
+			uintptr(unsafe.Pointer(&pwInfo)),
 			0, // parm_err
 		)
 		if ret != 0 {
 			return fmt.Errorf("resetting password for %s: %w", username, windows.Errno(ret))
 		}
+		// Reaffirm flags in case they drifted out-of-band (GPO, admin edit, disabled account).
+		flagsInfo := struct{ Flags uint32 }{Flags: ufScript | ufNormalAccount | ufDontExpirePasswd}
+		ret, _, _ = procNetUserSetInfo.Call(
+			0,
+			uintptr(unsafe.Pointer(namePtr)),
+			1008, // USER_INFO_1008: flags-only update level
+			uintptr(unsafe.Pointer(&flagsInfo)),
+			0,
+		)
+		if ret != 0 {
+			return fmt.Errorf("resetting flags for %s: %w", username, windows.Errno(ret))
+		}
 		return nil
 	}

Since this touches Win32 API usage (USER_INFO_1008 level semantics), please double-check against current MSDN docs before applying.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@orbit/pkg/managedaccount/managedaccount_windows.go` around lines 80 - 131,
Update ensureUser’s existing-account branch to re-apply ufNormalAccount and
ufDontExpirePasswd after resetting the password, using the documented
USER_INFO_1008 flags-only NetUserSetInfo level or an equivalent full USER_INFO_1
update. Preserve the existing password-reset behavior and return errors for the
flags update so retries restore the account’s required state.
orbit/pkg/managedaccount/managedaccount.go (1)

89-95: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Release the mutex before signaling done to avoid a synchronization gap.

close(r.done) runs before the deferred r.mu.Unlock() (defers execute after the function body). A test or future caller that unblocks on <-r.done and immediately calls Run() again could see TryLock() fail because the mutex may not be released yet — this is exactly the pattern used in managedaccount_test.go's "a failed escrow leaves nothing that would block a retry" test, which reassigns r.done and calls Run right after <-done. Currently harmless in production (r.done is always nil there), but it's a latent flakiness risk for this test pattern.

♻️ Proposed fix: unlock before closing done
 	go func() {
-		defer r.mu.Unlock()
-		r.createAndEscrow()
-		if r.done != nil {
-			close(r.done)
-		}
+		defer func() {
+			r.mu.Unlock()
+			if r.done != nil {
+				close(r.done)
+			}
+		}()
+		r.createAndEscrow()
 	}()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@orbit/pkg/managedaccount/managedaccount.go` around lines 89 - 95, Update the
goroutine in the managed-account run flow to release r.mu before signaling
completion through r.done. Replace the deferred unlock ordering around
createAndEscrow and close(r.done) so any caller unblocked by done can
immediately retry Run without encountering the still-held mutex.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@orbit/pkg/managedaccount/managedaccount_windows.go`:
- Around line 80-131: Update ensureUser’s existing-account branch to re-apply
ufNormalAccount and ufDontExpirePasswd after resetting the password, using the
documented USER_INFO_1008 flags-only NetUserSetInfo level or an equivalent full
USER_INFO_1 update. Preserve the existing password-reset behavior and return
errors for the flags update so retries restore the account’s required state.

In `@orbit/pkg/managedaccount/managedaccount.go`:
- Around line 89-95: Update the goroutine in the managed-account run flow to
release r.mu before signaling completion through r.done. Replace the deferred
unlock ordering around createAndEscrow and close(r.done) so any caller unblocked
by done can immediately retry Run without encountering the still-held mutex.

In
`@server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns_test.go`:
- Around line 11-48: Extend TestUp_20260728171642 to insert a new pending row
into host_managed_local_account_passwords with both encrypted_password and
command_uuid set to NULL after applyNext. Assert the insert succeeds, preserving
the existing checks for migrated non-NULL data and enrollment defaults.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ba89c8e-bfb4-417a-8733-13787c795bbf

📥 Commits

Reviewing files that changed from the base of the PR and between 360e4b7 and 38415e3.

📒 Files selected for processing (32)
  • client/orbit_client.go
  • ee/server/service/hosts.go
  • orbit/changes/48723-windows-managed-local-account
  • orbit/cmd/orbit/orbit.go
  • orbit/pkg/managedaccount/managedaccount.go
  • orbit/pkg/managedaccount/managedaccount_stub.go
  • orbit/pkg/managedaccount/managedaccount_test.go
  • orbit/pkg/managedaccount/managedaccount_windows.go
  • pkg/str/str.go
  • pkg/str/str_test.go
  • server/datastore/mysql/managed_local_account.go
  • server/datastore/mysql/managed_local_account_test.go
  • server/datastore/mysql/microsoft_mdm.go
  • server/datastore/mysql/microsoft_mdm_test.go
  • server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns.go
  • server/datastore/mysql/migrations/tables/20260728171642_ManagedLocalAccountWindowsEscrowColumns_test.go
  • server/datastore/mysql/schema.sql
  • server/fleet/api_orbit.go
  • server/fleet/apple_mdm.go
  • server/fleet/capabilities.go
  • server/fleet/datastore.go
  • server/fleet/hosts.go
  • server/fleet/microsoft_mdm.go
  • server/fleet/orbit.go
  • server/fleet/service.go
  • server/mock/datastore_mock.go
  • server/mock/service/service_mock.go
  • server/service/handler.go
  • server/service/hosts.go
  • server/service/hosts_test.go
  • server/service/orbit.go
  • server/service/orbit_test.go
💤 Files with no reviewable changes (1)
  • server/fleet/apple_mdm.go

Copilot AI review requested due to automatic review settings July 28, 2026 20:12
@getvictor getvictor closed this Jul 28, 2026
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 98 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.71%. Comparing base (ffc85a4) to head (8cd0f4d).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
server/service/orbit.go 0.00% 69 Missing ⚠️
server/service/hosts.go 0.00% 11 Missing ⚠️
pkg/str/str.go 0.00% 8 Missing ⚠️
server/fleet/api_orbit.go 0.00% 6 Missing ⚠️
server/fleet/hosts.go 0.00% 2 Missing ⚠️
server/fleet/capabilities.go 0.00% 1 Missing ⚠️
server/service/handler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #50087       +/-   ##
===========================================
- Coverage   68.00%   24.71%   -43.29%     
===========================================
  Files        3930     2686     -1244     
  Lines      250248   112034   -138214     
  Branches    13172    13391      +219     
===========================================
- Hits       170182    27693   -142489     
- Misses      64757    83767    +19010     
+ Partials    15309      574    -14735     
Flag Coverage Δ
backend 3.69% <0.00%> (-65.70%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

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

Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

server/service/orbit.go:1567

  • SkipAuthorization requires a justification comment starting with skipauth: (see server/authz/authz.go). The current comment doesn’t match that convention, which can lead to review/tooling failures and makes it harder to audit authorization skips.
    pkg/str/str.go:42
  • TruncateRunes truncates by doing []rune(s) which allocates a full rune slice of the entire input. Because this helper is intended for untrusted/device-supplied text (e.g. escrow client_error), a very large string could cause unnecessary memory pressure. You can truncate by scanning runes and slicing by byte index without allocating proportional to input size.
func TruncateRunes(s string, maxRunes int) string {
	if maxRunes <= 0 {
		return ""
	}
	if len(s) <= maxRunes {
		// Fast path: a string of at most maxRunes bytes cannot exceed maxRunes characters.
		return s
	}
	if utf8.RuneCountInString(s) <= maxRunes {
		return s
	}
	return string([]rune(s)[:maxRunes])
}

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.

2 participants