Skip to content

fix(registration): Identify the registering caller by username - #239

Merged
scotwells merged 1 commit into
feat/manual-inventory-recordsfrom
fix/registration-username-principal
Nov 28, 2026
Merged

scotwells merged 1 commit into
feat/manual-inventory-recordsfrom
fix/registration-username-principal

Conversation

@scotwells

@scotwells scotwells commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MachineCapacity registration refused any caller without a UID, so a publisher whose client certificate carries only a username could not register capacity.

Registration now identifies the caller by username, as Kubernetes RBAC does. The permission checks pass the UID when the credential has one.

Test plan

  • Build, unit, race, envtest, render and harness checks pass
  • A caller without a UID registers when RBAC binds its username, and is refused when nothing does
  • Removing the username check or requiring a UID again fails a test

The creator webhook gets the same rule in #182.

🤖 Generated with Claude Code

Registration admission for MachineCapacity refused any caller without a
UID. Some credentials, such as client certificates, carry a username but
no UID, so a publisher signed in with one could not register capacity.

A caller is now identified by username, as Kubernetes RBAC identifies it.
The UID stays optional: the SubjectAccessReviews carry it when the
credential has one, and the authorizer decides. A test against a real API
server binds RBAC to a username alone and registers as that user with no
UID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells requested review from ecv and kevwilliams November 27, 2026 22:37
@scotwells
scotwells marked this pull request as ready for review November 28, 2026 01:58
@scotwells
scotwells requested a review from a team as a code owner November 28, 2026 01:58

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

Username identifies the caller as RBAC does, UID passes through when present, and envtest proves bound and unbound UID-less callers behave.

@scotwells
scotwells merged commit 16e10bb into feat/manual-inventory-records Nov 28, 2026
9 checks passed
@scotwells
scotwells deleted the fix/registration-username-principal branch November 28, 2026 02:18
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