Skip to content

SEC-06: cmapi-automation uses the resource owner password grant, which RFC 9700 says MUST NOT be used #181

Closed
0 of 1 issue completed

Description

@ephico2real2

Part of #14

What is wrong: The client cmapi-automation has the resource owner password grant on, and cmapi's own proof scripts and documents sign in with it. RFC 9700 (OAuth 2.0 Security Best Current Practice), section 2.4: "The resource owner password credentials grant [RFC6749] MUST NOT be used." The grant gives a person's password to the client, and it cannot do a second factor.

Where: on b83391c:

  • deploy/helm/cmapi/templates/keycloak-realm.yaml:169 and deploy/manifests/environments/crc/realm/10-realm-import.yaml:316: directAccessGrantsEnabled: true for cmapi-automation. examples/cmapi-sso/realm/ephico2real.yaml:27 has the same.
  • deploy/crc-proof.sh:74 and :85: grant_type=password for bot-user and for each LDAP test user.
  • deploy/tests/realm-test.py:132 and :162, docs/15-keycloak-integration.md:145, examples/local/INSTALL.md:509.

Realm cmapi is not on CRC yet (#157 stops the run), so the first import can still have the fix.

How to prove it: grep -n "directAccessGrantsEnabled: true" deploy/manifests/environments/crc/realm/10-realm-import.yaml deploy/helm/cmapi/templates/keycloak-realm.yaml prints two lines today. After the fix, a test of the realm files finds no client with the grant on, deploy/tests/realm-test.py gets 400 unauthorized_client for grant_type=password on each client of realm cmapi, and no script or document of cmapi has grant_type=password for realm cmapi.

Measured or inferred: Measured on 2026-11-13 by the grep above, by OB1 and by the coordinator (at 933274a). The contracts review of diagram-kit PR 64 found it.

Severity: High. A production realm made from these files accepts passwords on the token endpoint for a confidential client.

What must hold after the fix: No client of realm cmapi has directAccessGrantsEnabled: true. The bot signs in as a service account (client credentials). The proof of an LDAP person's token does not send that person's password to the token endpoint from a script.

Research: Mandate, before the code: (1) RFC 9700 section 2.4 and RFC 6749 section 4.4 for the bot. docs/02 says the automation account is bot-user with the role cmapi-onboarding and requireOnBehalfOf: find how cmapi's identity code reads a service-account token (preferred_username is service-account-cmapi-automation, with no employee_id), and what must change in core/identity. (2) How to prove that an LDAP-federated person gets a token with the right groups without the password grant: the authorization code flow with PKCE driven by a script (a form post to Keycloak's login page), a browser run with Playwright, the device authorization grant (RFC 8628), or token exchange and impersonation in Keycloak 26. State the choice and its sources in the pull request. (3) The local demo of examples/local uses the grant on a throwaway Keycloak: decide whether it changes too.

Solution (inline, not applied): Not written here.

Class: INV. The fix changes how the automation client signs in and adds a check that stops the grant from coming back.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    bug
    class:INV
    status:open
    sev:high
    Backlog
    on Nov 13, 2026
  2. added
    In-Progress
    and removed
    Backlog
    on Nov 13, 2026
  3. added
    In-QA
    and removed
    In-Progress
    on Nov 13, 2026
  4. ephico2real2 commented on Nov 13, 2026

    @ephico2real2
    OwnerAuthor

    In-QA: pull request #190 is ready, head e62a79a. The realm test passed on a real Keycloak in GitHub's manifests job (run 43511671215 on b3fb270): each of the 13 LDAP test users signs in by the login form, cmapi-automation signs in with client credentials, each of the 14 clients refuses the password grant, and the sync brings an old realm to the new state. Codex's review is ruled in docs/reviews/2026-11-13-issue-181/README.md: five fixes accepted. docs/01 and docs/02 are changed (live revisions 168 and 299). The checks run again on e62a79a.

  5. added a commit that references this issue on Nov 13, 2026
  6. added
    Done
    and removed
    In-QA
    on Nov 13, 2026
  7. ephico2real2 commented on Nov 13, 2026

    @ephico2real2
    OwnerAuthor

    Done: pull request #190 merged to main. GitHub Actions run 43515015389 was green on the exact head e62a79a (six jobs). The realm test on a real Keycloak and OpenLDAP passed in the manifests job (realm cases failed: 0, first measured in run 43511671215): 13 LDAP test users sign in by the login form, cmapi-automation signs in with client credentials, each of the 14 clients refuses the password grant, and the sync brings an old realm to the new state. Native on macOS: the service suite 562 passed, oidc-login-test.py 20 cases. Review by Codex gpt-6.1-sol, ruled in docs/reviews/2026-11-13-issue-181/README.md. Not measured on CRC: realm cmapi is not there. #189 has the local demo.

  8. added a commit that references this issue on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Donebugclass:INVsev:highstatus:open

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions