Skip to content

feat: stamp strategy and groups on every <user>-clientconfig Secret (#42) - #44

Merged
braghettos merged 2 commits into
mainfrom
feat/clientconfig-identity-annotations
Oct 29, 2026
Merged

braghettos merged 2 commits into
mainfrom
feat/clientconfig-identity-annotations

Conversation

@braghettos

Copy link
Copy Markdown
Collaborator

Closes #42. This replaces #43, which GitHub closed when its stacked base (#41's branch) was deleted on merge. The branch, now rebased onto main, is unchanged, and its tree is byte-identical to the commit the e2e below tested.

Why

Tenant onboarding (a Kyverno GeneratingPolicy in saas) fires on every <user>-clientconfig Secret, but nothing on them identified the credential. The decision is that authn stamps the identity facts it already knows, and the policy decides from them.

What

Every clientconfig authn writes now carries two annotations, alongside #40's certificate-not-{before,after}:

Annotation Value
authn.krateo.io/strategy basic / ldap / oauth / oidc / serviceaccount; self for authn-clientconfig; unknown only from the backfill
authn.krateo.io/groups the certificate's O=, newline-separated
  • Why newlines: group names can contain commas, e.g. Azure groups passed through verbatim by OIDC.
  • Newline in a group name: the login is refused before any certificate is minted (storage.ValidateGroups).
  • Strategy source: Generator.Generate now takes the issuing strategy, and every route passes its own. authn's own identity gets self from the certificate renewer's annotation sync.
  • Startup backfill (internal/identitybackfill): stamps Secrets that predate these annotations, and never overwrites existing ones.
    • Groups are read from the stored certificate.
    • Strategy is self, serviceaccount (a mapping with that username exists) or basic (a basic User exists); otherwise unknown. "Both a mapping and a basic User exist" is also unknown.
    • An unreadable certificate or a failed lookup means the Secret is skipped and logged, never stamped with a guess.
  • No new RBAC. authn already has list/update on Secrets in its namespace.

Consumer

acmp's onboarding selects positively: it creates a tenant only when the groups contain tenants, and a missing annotation means no onboarding. So the backfill must run (authn 0.28.0) before the demo cutover.

Tests

🤖 Generated with Claude Code

https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ

)

Tenant onboarding fires on every clientconfig Secret, but nothing on them told a
tenant from a platform admin or from authn's own identity. Every clientconfig
authn writes now carries:

- authn.krateo.io/strategy: basic|ldap|oauth|oidc|serviceaccount, or self for
  authn's own identity (via the certificate renewer)
- authn.krateo.io/groups: the certificate's O=, newline-separated, because group
  names can contain commas. A group containing a newline is refused before
  anything is minted.

Generator.Generate now takes the issuing strategy, and every login route passes
its own.

A startup backfill (internal/identitybackfill) stamps Secrets that predate the
annotations and never overwrites existing ones. Groups come from the stored
certificate. Strategy is self, serviceaccount (a mapping with that username
exists) or basic (a basic User exists); otherwise unknown, including when both
exist. A Secret whose certificate or lookup fails is skipped, never stamped with
a guess.

No new RBAC: authn already holds list/update on Secrets in its namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TLFnUe4HXFphxQNAfqFawZ
@braghettos
braghettos merged commit e013214 into main Oct 29, 2026
17 checks passed
@braghettos
braghettos deleted the feat/clientconfig-identity-annotations branch October 29, 2026 15:11
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.

Stamp identity facts (strategy, groups) on every <user>-clientconfig Secret

1 participant