Skip to content

feat: Block deleting in-service Devices with an opt-in admission policy - #177

Merged
scotwells merged 3 commits into
mainfrom
feat/device-deletion-protection
Nov 24, 2026
Merged

scotwells merged 3 commits into
mainfrom
feat/device-deletion-protection

Conversation

@scotwells

@scotwells scotwells commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Related to #90, which this lands a piece of. #90 keeps a copy of the same component until it is rebuilt from main.

Adds an opt-in admission policy that stops an in-service Device from being deleted, so its serial and system UUID stay visible to duplicate-hardware checks. A Device can be deleted once it is Retired, when its namespace is being deleted, or by a configured cleanup identity, which is off as shipped. No root in this repository includes the policy, so merging deploys nothing. The operations guide covers the rules and how to turn on the cleanup identity.

Test plan

  • A live API server denies deleting an active Device, and admits a Retired Device and one in a namespace being deleted.
  • A listed cleanup identity can delete only while its ConfigMap exists, and a missing ConfigMap denies every delete.
  • Dropping the Retired exception from the policy fails the tests and the repository's overlay check.
  • CI is green.

🤖 Generated with Claude Code

scotwells and others added 3 commits November 24, 2026 17:03
Add an opt-in component with a ValidatingAdmissionPolicy that denies
Device deletes unless the Device is Retired, its namespace is being
deleted, or the caller is a configured cleanup identity. No root in
this repository includes it; deploying repositories opt in.

Document the rule and the cleanup identity in the physical inventory
guide, including that Milo should mark namespaces for deletion before
purging their contents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extend the overlay isolation validator to require the exact fail-closed
policy when the component renders alone, and to reject any root that
renders a Device deletion policy. Add weakened-policy fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the component in a disposable API server and evaluate its
expression offline. Cover each delete path, the cleanup identity and
the fail-closed missing ConfigMap case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells requested a review from a team as a code owner November 24, 2026 23:04
@scotwells
scotwells requested review from ecv and kevwilliams November 24, 2026 23:04

@kevwilliams kevwilliams 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.

Verified at a 1.37 API server that direct, collection and impersonated deletes of non-Retired Devices are denied, and breaking the CEL turns three tests red.

@scotwells
scotwells merged commit 43c5161 into main Nov 24, 2026
6 checks passed
@scotwells
scotwells deleted the feat/device-deletion-protection branch November 24, 2026 23:13
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