Skip to content

fix(admission): Keep Machine power to the power projector - #224

Draft
scotwells wants to merge 3 commits into
feat/manual-inventory-recordsfrom
fix/machine-power-status-writer
Draft

scotwells wants to merge 3 commits into
feat/manual-inventory-recordsfrom
fix/machine-power-status-writer

Conversation

@scotwells

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #182: nothing but convention kept identities other than the power projector from writing a Machine's observed power. RBAC can't close this, because Milo authorizes a status write with the Machine's own update and patch permissions, which the consumer roles hold. This change adds admission that refuses a power change from anyone but the projector's identity: a fail-closed webhook in the Milo root, named by a new registration flag, and an admission policy with the same rule in standalone. A render check over every root fails if another role gains Machine status access.

Related to #182

Decisions for a person

  • Consumers can still write other Machine status fields in Milo. Closing that needs Milo's subresource authorization turned on, a status subresource on the Machine protected resource, and status update and patch held by the controller role alone. That's a platform change, not Fleet's alone.
  • The synthetic Milo root and the local multi-plane Milo have no power guard. Neither runs the registration service, and Milo ignores admission policies stored in a project. The creator webhook has the same gap.
  • The writer flag is unset in the Milo root. Every power change is refused there until it names the manager's identity. Set it before a power projector runs against that root.
  • Landing order with feat(admission): Record who created each Machine #188. Both add a webhook to the registration server's handler list, so whichever lands second needs a small rebase.

Test plan

  • Build, unit, race, envtest, render and harness checks pass
  • Against a real API server, the webhook and the standalone policy refuse power changes, by update and by patch, from 9 other identities, and admit the projector's
  • Each guard's test fails when that guard is removed or weakened
  • The render check fails when another role gains Machine status access

🤖 Generated with Claude Code

@scotwells
scotwells requested review from ecv and kevwilliams November 26, 2026 03:47
scotwells and others added 3 commits November 25, 2026 21:47
Nothing but convention stopped another identity from writing a Machine's
status.power. In Milo, a status write is authorized with the Machine's
update and patch permissions, which the consumer roles hold, and the
manager's other status writers share the projector's identity, so RBAC
cannot hold the field to one writer.

Add a fail-closed webhook, served by fleet-registration, that admits a
change to status.power only from the identity named by its new
--machine-power-writer flag; unset, every power change is refused. Only
status writes that change power are routed. config/milo installs it, and
config/standalone enforces the same rule with a ValidatingAdmissionPolicy
admitting only the smoke runner, which runs the projector there.

A render check over every root fails when another Kubernetes role gains
Machine status writes or another Milo role gains a Machine status, update
or patch permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nder check

Name the webhook under the Machine's own API group, and add it and its
writer flag to the registration rollout contract. The render check now
reads roles held in JSON strings and treats an aggregated ClusterRole as a
Machine status writer. Move the writer audit into the device custody guide
and drop deployment state from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells force-pushed the fix/machine-power-status-writer branch from 124982e to 0b4c1d7 Compare November 26, 2026 03:47
Base automatically changed from feat/device-custody-cutover to feat/manual-inventory-records November 28, 2026 14:54
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.

1 participant