Skip to content

[Experimental] Make LDAP/AD authconfig UserIDAttribute and GroupIDAttribute fields immutable#1451

Draft
pmatseykanets wants to merge 1 commit into
rancher:mainfrom
pmatseykanets:ldap-ad-configurable-principal-id
Draft

[Experimental] Make LDAP/AD authconfig UserIDAttribute and GroupIDAttribute fields immutable#1451
pmatseykanets wants to merge 1 commit into
rancher:mainfrom
pmatseykanets:ldap-ad-configurable-principal-id

Conversation

@pmatseykanets

@pmatseykanets pmatseykanets commented May 11, 2026

Copy link
Copy Markdown
Contributor

Issue: rancher/rancher#55642

Problem

With rancher/rancher#54912 Rancher now has UserIDAttribute and GroupIDAttribute fields in LDAP/AD authconfigs, letting admins choose a stable LDAP
attribute (e.g. sAMAccountName) as the principal identifier instead of DN.

These fields must be immutable after the provider is enabled — changing them
would silently break all RBAC bindings (CRTBs, PRTBs, GRBs) that reference
the old principal name. Rancher's testAndApply enforces this for the
UI/API flow, but kubectl apply, Terraform, and direct API mutations
bypass it.

Solution

The webhook now enforces two things for UserIDAttribute and GroupIDAttribute:

  • Format validation: both fields are validated with IsValidLdapAttr
    (RFC 4512), same as every other LDAP attribute field.
  • Immutability on enabled providers: when both the old and new config
    have Enabled == true, any change to either field is rejected with a
    field.Invalid error. To change these fields, the admin must disable
    the provider first, apply the change, then re-enable — which is the
    supported reconfiguration path.

Depends on rancher/rancher#54912 for the type definitions.

CheckList

  • Test
  • Docs

@pmatseykanets pmatseykanets self-assigned this May 11, 2026
Comment thread go.mod

toolchain go1.25.9

replace github.com/rancher/rancher/pkg/apis => github.com/pmatseykanets/rancher/pkg/apis v0.0.0-20260504145013-06d2cbb05095

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will be removed once the rancher PR is merged.

@pmatseykanets pmatseykanets force-pushed the ldap-ad-configurable-principal-id branch 2 times, most recently from a18e177 to c87ffcc Compare May 11, 2026 16:08
@pmatseykanets pmatseykanets force-pushed the ldap-ad-configurable-principal-id branch from c87ffcc to 7ecf73c Compare May 11, 2026 16:20
@pmatseykanets pmatseykanets changed the title Make LDAP/AD authconfig UserIDAttribute and GroupIDAttribute fields immutable [Experimental] Make LDAP/AD authconfig UserIDAttribute and GroupIDAttribute fields immutable May 11, 2026
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