Skip to content

IFC-2664 lock password changes for externally authenticated accounts#9391

Draft
gmazoyer wants to merge 4 commits into
developfrom
gma-20260529-ifc2664
Draft

IFC-2664 lock password changes for externally authenticated accounts#9391
gmazoyer wants to merge 4 commits into
developfrom
gma-20260529-ifc2664

Conversation

@gmazoyer
Copy link
Copy Markdown
Contributor

@gmazoyer gmazoyer commented May 29, 2026

Why

Any account provisioned through an external identity provider (LDAP, OIDC, OAuth2) could overwrite its local password through the self-update mutation, then sign in via the local-auth endpoint with the chosen password. The bypass survived directory-side revocation. This PR closes that gap on both the security side (backend) and the UX side (the frontend never lets the user reach the form).

Found while exercising LDAP against a live Active Directory; the bug applies to every account linked to an external identity, not just LDAP ones.

What changed

The self-update mutation now refuses to write the password when the account is linked to an external identity, while continuing to accept description-only updates. The current account profile gains a boolean flag so the frontend can act before any submission. The synthesized field is added on the account interface.

Three alternative shapes for the signal can be considered (whitelisting the relationship in the schema-gen filter, moving the underlying type out of the Internal namespace, encoding the source in JWT claims).

The profile page reads the new flag, hides the Password tab for externally managed accounts, and shows an "externally managed" panel on the password page for direct navigation. The earlier reactive error-string workaround is gone.

Checklist

  • Tests added/updated
  • Changelog entry added (uv run towncrier create ...)
  • I have reviewed AI generated content

Summary by cubic

Blocks local password changes for accounts linked to external identity providers and hides the password UI for those users. Fixes the bypass letting LDAP/OIDC/OAuth2 users set a local password and log in via local auth (IFC-2664).

  • Bug Fixes
    • Backend: InfrahubAccountSelfUpdate rejects password updates when an ExternalIdentity exists; description-only updates still allowed.
    • GraphQL: added is_externally_managed (Boolean!) to CoreGenericAccount/CoreAccount and AccountProfile; resolver returns true if a linked external identity exists.
    • Frontend: reads is_externally_managed; hides the Password tab unless it’s false (also while loading); shows a loading state on the Password tab while the profile resolves; shows a “Password managed externally” panel; toasts mutation errors.
    • Tests: coverage for password rejection, allowed description updates, tab visibility (including loading), password-tab loading state, externally managed panel, and form submit.
    • Changelog: security entry added.

Written for commit c57ff6f. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added group/backend Issue related to the backend (API Server, Git Agent) group/frontend Issue related to the frontend (React) labels May 29, 2026
@gmazoyer gmazoyer force-pushed the gma-20260529-ifc2664 branch from 031ac8d to d04edee Compare May 29, 2026 13:36
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.

2 issues found across 11 files

Confidence score: 3/5

  • There is some merge risk: backend/infrahub/graphql/resolvers/resolver.py may return inconsistent external-identity data if GraphQL branch/timestamp context is not passed through, which can surface incorrect results across branch/time views.
  • frontend/app/src/entities/user-profile/ui/tab-update-password.tsx currently renders the password form before profile state is resolved, so users can briefly see the wrong UI state instead of a proper loading/unknown guard (as noted in IFC-2664).
  • Pay close attention to backend/infrahub/graphql/resolvers/resolver.py and frontend/app/src/entities/user-profile/ui/tab-update-password.tsx - context propagation and loading-state handling are the main user-facing risk areas.

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread frontend/app/src/entities/user-profile/ui/tab-update-password.tsx Outdated
Comment thread backend/infrahub/graphql/resolvers/resolver.py
@gmazoyer gmazoyer force-pushed the gma-20260529-ifc2664 branch 2 times, most recently from ead4c35 to da45250 Compare May 29, 2026 14:01
@gmazoyer gmazoyer force-pushed the gma-20260529-ifc2664 branch from da45250 to d8185f7 Compare May 29, 2026 15:12
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 29, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing gma-20260529-ifc2664 (c57ff6f) with develop (db56c32)

Open in CodSpeed

@gmazoyer gmazoyer force-pushed the gma-20260529-ifc2664 branch from d8185f7 to 3d98f30 Compare May 30, 2026 09:53
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.

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would require human review. This security fix modifies core backend mutation logic, adds a dynamic GraphQL field, and alters frontend account behavior, which carries risk of unintended side effects in account management and requires human review.

Re-trigger cubic

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) group/frontend Issue related to the frontend (React)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant