26.8.2-1 rejects master-realm admin tokens with 401 #33

Stängd
öppnade 2026-11-29 14:13:44 +00:00 av supernaut · 1 kommentar
Ägare

Image 26.8.2-1 breaks admin access for master-realm service accounts. Deployment was reverted to 26.8.1-1 (bitborg/bitborg-infra#914) after a staging test.

Observed on staging, 2026-11-29

  • The opentofu client in the master realm gets a token with client_credentials (200). Issuer: https://id.stg.bitborg.se/realms/master. Audience includes bitborg-realm and master-realm.
  • Every admin endpoint answers 401 to that token, /admin/serverinfo included. 401, not 403, so authentication fails, not authorisation.
  • Sending Host, X-Forwarded-Host and X-Forwarded-Proto for the public hostname changes nothing.
  • Tokens from the bitborg realm still work against the admin API. The entitlement reconciler completes and sign-in works.
  • On 26.8.1-1 the same calls return 200, before and after the test.

The container sets KC_HOSTNAME=https://<id domain> and KC_HOSTNAME_ADMIN=http://127.0.0.1:<forward port>. Admin calls go to the forwarded port.

sequenceDiagram
  participant A as admin client (opentofu)
  participant K as Keycloak 26.8.2
  A->>K: POST /realms/master/.../token (client_credentials)
  K-->>A: 200, iss = https://id.../realms/master
  A->>K: GET /admin/serverinfo (Bearer)
  K-->>A: 401

Next steps

  • Read the upstream 26.8.2 release notes and security advisories for changes to admin token validation, issuer checks or hostname-admin.
  • Reproduce locally with scripts/smoke-test.sh plus a client_credentials admin call, on 26.8.1-1 and 26.8.2-1.
  • Do not merge a Renovate bump to 26.8.2 or later until this is understood.
Image `26.8.2-1` breaks admin access for master-realm service accounts. Deployment was reverted to `26.8.1-1` (bitborg/bitborg-infra#914) after a staging test. ## Observed on staging, 2026-11-29 - The `opentofu` client in the `master` realm gets a token with `client_credentials` (200). Issuer: `https://id.stg.bitborg.se/realms/master`. Audience includes `bitborg-realm` and `master-realm`. - Every admin endpoint answers 401 to that token, `/admin/serverinfo` included. 401, not 403, so authentication fails, not authorisation. - Sending `Host`, `X-Forwarded-Host` and `X-Forwarded-Proto` for the public hostname changes nothing. - Tokens from the `bitborg` realm still work against the admin API. The entitlement reconciler completes and sign-in works. - On `26.8.1-1` the same calls return 200, before and after the test. The container sets `KC_HOSTNAME=https://<id domain>` and `KC_HOSTNAME_ADMIN=http://127.0.0.1:<forward port>`. Admin calls go to the forwarded port. ```mermaid sequenceDiagram participant A as admin client (opentofu) participant K as Keycloak 26.8.2 A->>K: POST /realms/master/.../token (client_credentials) K-->>A: 200, iss = https://id.../realms/master A->>K: GET /admin/serverinfo (Bearer) K-->>A: 401 ``` ## Next steps - Read the upstream 26.8.2 release notes and security advisories for changes to admin token validation, issuer checks or `hostname-admin`. - Reproduce locally with `scripts/smoke-test.sh` plus a `client_credentials` admin call, on `26.8.1-1` and `26.8.2-1`. - Do not merge a Renovate bump to 26.8.2 or later until this is understood.
supernaut lade till detta till projektet Bitborg Keycloak 2026-11-29 14:14:17 +00:00
Upphovsperson
Ägare

Cause: Keycloak 26.8.2 fixes CVE-2026-19688 (GHSA-5624-rq7x-6m4q, upstream keycloak/keycloak#54902). The admin API now returns 401 for any token without the new kc-admin-api client scope. The migration assigns it only to built-in and bootstrap clients. That hit opentofu and the bitborg-realm service accounts alike: the reconciler also failed until the fix.

Fixed in bitborg/bitborg-infra#915 (assign kc-admin-api to the admin clients, bump to 26.8.2-1) and bitborg/bitborg-infra#917 (admin-permissions lookup over the API, runbook bootstrap fixes). Prod upgraded 2026-11-29. The health gate passes and a full realm plan is empty.

Cause: Keycloak 26.8.2 fixes CVE-2026-19688 (GHSA-5624-rq7x-6m4q, upstream keycloak/keycloak#54902). The admin API now returns 401 for any token without the new `kc-admin-api` client scope. The migration assigns it only to built-in and bootstrap clients. That hit `opentofu` and the bitborg-realm service accounts alike: the reconciler also failed until the fix. Fixed in bitborg/bitborg-infra#915 (assign `kc-admin-api` to the admin clients, bump to 26.8.2-1) and bitborg/bitborg-infra#917 (`admin-permissions` lookup over the API, runbook bootstrap fixes). Prod upgraded 2026-11-29. The health gate passes and a full realm plan is empty.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-keycloak#33
Ingen beskrivning angiven.