Skip to content

Drop LDAP email attribute#9361

Open
gmazoyer wants to merge 1 commit into
developfrom
gma-20260527-ifc2605
Open

Drop LDAP email attribute#9361
gmazoyer wants to merge 1 commit into
developfrom
gma-20260527-ifc2605

Conversation

@gmazoyer
Copy link
Copy Markdown
Contributor

@gmazoyer gmazoyer commented May 27, 2026

Why

Two community-side LDAP loose ends. First, LDAPSettings carries an attribute_email field that doesn't pay rent: the community account schema has no email field, and the LDAP runtime never reaches the place where ExternalIdentity.email matters (SSO uses it as a fallback name on display-name collision, but the LDAP path refuses same-name collisions outright before that fallback would fire). Operators get a knob they don't need on an already-busy config block. Second, the SSO model requires email to be a non-empty string, which means LDAP either fabricates a value or carries one through purely to keep the schema happy. Making email optional removes the fabrication.

What changed

LDAPSettings.attribute_email is removed.

ExternalIdentity.email becomes str | None, defaulting to None. OIDC and OAuth2 callers still pass it; the LDAP runtime can now omit it.


Summary by cubic

Warns at startup when LDAP is configured on community deployments (it’s inert there), and removes the unused LDAP email attribute. Makes ExternalIdentity.email optional and adds a clear error when a name collision needs an email but the provider didn’t supply one; updates docs and the sample config.

  • New Features

    • Log one WARNING per worker if LDAP is admin-enabled on community, so operators know the config won’t be used.
    • Raise a clear error when a display-name collision occurs and no email is available for fallback.
  • Migration

    • Remove LDAPSettings.attribute_email and any INFRAHUB_LDAP_ATTRIBUTE_EMAIL env var from configs.
    • Handle None for ExternalIdentity.email in any custom code; OIDC/OAuth2 still provide it.

Written for commit 209361f. Summary will update on new commits. Review in cubic

@github-actions github-actions Bot added type/documentation Improvements or additions to documentation group/backend Issue related to the backend (API Server, Git Agent) labels May 27, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. These changes are low-risk: they add a startup warning for inert LDAP config on community deployments, remove an unused LDAP email attribute, and make ExternalIdentity.email optional with backward-compatible handling, all covered by unit tests and isolated from core business logic.

Re-trigger cubic

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 27, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing gma-20260527-ifc2605 (209361f) with develop (0b7577c)

Open in CodSpeed

@gmazoyer gmazoyer force-pushed the gma-20260527-ifc2605 branch from bc5bdf3 to 470ab75 Compare May 27, 2026 11:17
@ogenstad
Copy link
Copy Markdown
Contributor

Hey @gmazoyer, I'm wondering if this is actually needed if you check this validation: https://github.com/opsmill/infrahub/blob/develop/backend/infrahub/server.py#L54

The idea would be that if you try to enable LDAP in the community version the server would fail to start.

The community account schema has no email field, and the LDAP path
explicitly diverges from SSO's silent-takeover semantics so the email
fallback in account-name resolution is never reached. Collecting an
LDAP email attribute we never use only adds operator surface to a
config block that is already easy to misread.

Email stays available on the shared external-identity model for the
SSO providers that do use it; the LDAP runtime omits it. `_pick_account_name`
gains an explicit branch that raises when the fallback is needed but
the identity provider did not supply an email, instead of dereferencing
a missing value.
@gmazoyer gmazoyer force-pushed the gma-20260527-ifc2605 branch from 470ab75 to 209361f Compare May 27, 2026 11:56
@gmazoyer gmazoyer changed the title Warn about inert LDAP config on community and drop email attribute Drop LDAP email attribute May 27, 2026
@gmazoyer gmazoyer marked this pull request as ready for review May 27, 2026 13:31
@gmazoyer gmazoyer requested review from a team as code owners May 27, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/backend Issue related to the backend (API Server, Git Agent) type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants