Skip to content

BUG-51: the realm test's old state keeps the at+jwt attribute, because Keycloak does not remove an attribute that a client update leaves out #196

Closed

Description

@ephico2real2

Part of #184

What is wrong: The realm test puts back the state of a realm that was imported before #184, and its check of that state fails on a real Keycloak. The test sends a PUT of the client cmapi-automation with the attribute access.token.header.type.rfc9068 left out. Keycloak does not remove an attribute that an update leaves out. So the client keeps the attribute, the token keeps the header typ: at+jwt, and the case "without the attribute Keycloak writes the header typ JWT" fails.

Where: deploy/tests/realm-test.py:208 on a3cea8b (PR #195, not merged). Keycloak 26.6.4, RepresentationToModel.updateClientProperties, lines 542 to 546: for (Map.Entry<String, String> entry : rep.getAttributes().entrySet()) calls client.setAttribute(entry.getKey(), val). There is no removal.

How to prove it: GitHub's manifests job, step "The realm on a real Keycloak and LDAP stand-in, beside other realms". Before: run 43518252086 on a3cea8b, realm cases failed: 1. After the fix: realm cases failed: 0, with the cases "without the attribute Keycloak writes the header typ JWT" and "the sync put the header typ at+jwt back" both ok.

Measured or inferred: Measured on 2026-11-13 in run 43518252086 (Keycloak in a container on GitHub's runner). The cause is read from Keycloak's source at tag 26.6.4. No container runs on this Mac (#157).

Severity: Low. The defect is in a test. The product code is not wrong: the sync sets the attribute when its value is not true.

What must hold after the fix: The old-state step makes Keycloak write the header JWT for cmapi-automation, so that the check after the sync can fail. The step sets the attribute to false, which Keycloak reads as off (OIDCAdvancedConfigWrapper.isUseRfc9068AccessTokenHeaderType: Boolean.parseBoolean(getAttribute(..., "false"))), and which the sync reads as "not true".

Research: Keycloak's source at tag 26.6.4, files RepresentationToModel.java and OIDCAdvancedConfigWrapper.java (copies in docs/reviews/2026-11-13-issue-184/codex-report.md's sources).

Solution (inline, not applied): In the PUT of the old state: "attributes": {**(auto.get("attributes") or {}), "access.token.header.type.rfc9068": "false"}.

Class: No class. The fix corrects a test and adds nothing.

Activity

  1. added
    bug
    status:open
    sev:low
    In-Progress
    on Nov 13, 2026
  2. added 2 commits that reference this issue on Nov 13, 2026
    079ecf4
    222ff13
  3. added
    Done
    and removed
    In-Progress
    on Nov 13, 2026
  4. ephico2real2 commented on Nov 13, 2026

    @ephico2real2
    OwnerAuthor

    Done: fixed in pull request #195 (079ecf4), merged to main (9a5a9d6). Before: run 43518252086 on a3cea8b, realm cases failed: 1. After: run 43521078691 on 079ecf4, realm cases failed: 0, with "without the attribute Keycloak writes the header typ JWT ...: JWT" and "the sync put the header typ at+jwt back" both ok. Both ran in GitHub's manifests job on a real Keycloak in a container. Nothing ran on this Mac (#157).

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

    Donebugsev:lowstatus:open

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions