Update Keycloak to version 26.5.7 and dependencies#4096
Conversation
Keycloak 26.5.7 Migration Impact Report for Lagoon - Preliminary UnreviewedBaseline version: 26.4.7 SummaryOf the changes introduced between Keycloak 26.5.0 and 26.5.7, one is critical and requires a migration plan before upgrading. Several others require code-level fixes or are operational concerns for large deployments. The remainder do not impact Lagoon's setup. Impacted Items1. Fine-Grained Admin Permissions (FGAP) v1 DeprecatedSeverity: Critical — Requires Migration Plan Lagoon's startup explicitly enables FGAP v1: # services/keycloak/entrypoints/kc-startup.sh
/opt/keycloak/bin/kc.sh "$@" --features="scripts,token-exchange:v1,admin-fine-grained-authz:v1,quick-theme"The
All of Lagoon's access control for the API layer flows through this FGAP v1 configuration. If the feature is removed in a future Keycloak version, Lagoon's authorization will be completely non-functional. Action required:
2. Deprecated Bootstrap Admin Environment VariablesSeverity: Medium — Requires Code Fix Keycloak 26.5.x deprecated the The root cause is in # current — uses deprecated KEYCLOAK_ADMIN
KEYCLOAK_USER=$KEYCLOAK_ADMIN_USER KEYCLOAK_PASSWORD=$KEYCLOAK_ADMIN_PASSWORD KEYCLOAK_ADMIN=$KEYCLOAK_ADMIN_USER /lagoon/kc-startup.sh "$@"The default values are set in the Action required: Update # updated
KC_BOOTSTRAP_ADMIN_USERNAME=$KEYCLOAK_ADMIN_USER KC_BOOTSTRAP_ADMIN_PASSWORD=$KEYCLOAK_ADMIN_PASSWORD /lagoon/kc-startup.sh "$@"This must be done before Keycloak removes the deprecated variables in a future release. 3. HTTP Paths with Semicolons RejectedSeverity: Medium — Integration Risk Keycloak now rejects HTTP requests containing a semicolon ( Lagoon constructs Keycloak URLs from environment variables in: Semicolons in URLs are uncommon but could theoretically appear in environment variable values or in request parameters passed through to Keycloak. Action required: Low-risk but worth noting. Add 4.
|
| Service Account | Roles Granted |
|---|---|
service-account-lagoon-opensearch-sync |
query-groups, view-users |
service-account-service-api |
query-groups, view-users |
Neither account uses query-* as their only role, and neither is known to call role listing APIs — they primarily read users and groups. The full realm-admin role (assigned to the api service account via uma_protection) is unaffected.
Action required: Verify that no Lagoon service or custom extension calls role listing endpoints using credentials from lagoon-opensearch-sync or service-api. If they do, add view-realm or view-clients to those service accounts as appropriate.
8. Stricter Access Control for Managing Permission Tickets
Severity: Low
Introduced: 26.5.6
Only users or service accounts with the uma-protection role can manage permission tickets for a resource server. The resource server itself is exempt.
The Lagoon api client is the resource server and already has uma_protection configured correctly on service-account-api. The api client itself is the resource server and is explicitly exempt from this restriction.
Action required: None. Lagoon's configuration already meets the new requirements.
9. Outgoing HTTP Client Connection Timeout Default Changed
Severity: Low — Monitor
Introduced: 26.5.0
Keycloak's outgoing HTTP client now has a default connection-request-timeout-millis of 5,000ms (previously unlimited). This affects any outgoing HTTP calls Keycloak makes (e.g., to external identity providers, JWKS endpoints, or email servers).
For Lagoon's standard setup with no external OIDC providers configured by default, this is unlikely to cause issues. However, for Lagoon instances configured with external SMTP servers or federated identity providers that may be slow to respond, timeouts could occur where they previously did not.
Action required: Monitor Keycloak logs after upgrading for timeout errors on outgoing connections. If needed, configure:
--spi-connections-http-client-default-connection-request-timeout-millis=<ms>
10. session_state and sid Format Change
Severity: Low — Verify Token Consumers
Introduced: 26.5.0
session_state and sid in OpenID Connect tokens are no longer UUIDs. They are now 24-character random base64-encoded strings. The specs define these as opaque strings, so well-behaved consumers are not affected.
Lagoon's token validation in keycloakClient.ts does not inspect session_state or sid. However, any UI, CLI, or downstream integrations that store or validate these values as UUIDs could break.
Action required: Audit any Lagoon components or integrations that store or compare session_state / sid values against a UUID format pattern.
Not Impacted
| Change | Reason |
|---|---|
| SAML SubjectConfirmationData validation (26.5.4) | Lagoon does not use SAML |
| SAML redirect binding inflating size limit (26.5.4) | Lagoon does not use SAML |
| Loopback hostname verification on Windows (26.5.0) | Lagoon runs on Linux containers |
| PostgreSQL 13 end-of-life (26.5.0) | Lagoon uses MariaDB |
PostgreSQL pg_class/pg_namespace permissions (26.5.0) |
Lagoon uses MariaDB |
MS SQL Server READ_COMMITTED_SNAPSHOT (26.5.0) |
Not applicable |
| HTML in login theme message keys (26.5.0) | Lagoon's login theme has no messages_en.properties; only email theme messages exist |
| Client session timeout validation (26.5.0) | All clientSessionIdleTimeout / clientSessionMaxLifespan values are 0 (use realm defaults) |
Organization custom id attribute (26.5.0) |
Lagoon does not use Keycloak Organizations |
| SPIFFE Identity Provider (26.5.0) | Not configured |
| Virtual threads CPU threshold change (26.5.2) | Operational change; no configuration needed |
| HTTP access log sensitive data omission (26.5.5) | Security improvement; no action needed |
UserProfile#toRepresentation(boolean) API change (26.5.0) |
Lagoon does not implement UserProfile |
AuthenticationManager.AuthResult is now a record (26.5.0) |
Lagoon does not extend Keycloak's services module |
token-exchange:v1 feature |
Still in use and not deprecated in 26.5.x |
Priority Summary
| Priority | Item |
|---|---|
| Critical | Plan FGAP v1 → v2 migration |
| Medium | Update deprecated KEYCLOAK_ADMIN/KEYCLOAK_ADMIN_PASSWORD env vars in default-keycloak-entrypoint.sh |
| Medium | Check BROKER_LINK and OFFLINE_USER_SESSION index migration for large deployments |
| Low | Add semicolon guard to KEYCLOAK_URL parsing |
| Low | Audit service accounts for role listing API usage (26.5.6) |
| Low | Monitor outgoing HTTP timeout behaviour |
| Low | Audit session_state/sid consumers for UUID format assumptions |
Files Referenced
services/keycloak/entrypoints/kc-startup.shservices/keycloak/entrypoints/default-keycloak-entrypoint.shservices/keycloak/Dockerfileservices/keycloak/lagoon-realm-base-import.jsonservices/keycloak/javascript/policies/services/api/src/clients/keycloak-admin.tsservices/api/src/clients/keycloakClient.ts
This pull request updates the Keycloak service and its custom protocol mapper to use newer versions of Keycloak, dependencies, and build tools. The changes improve compatibility, security, and maintainability by keeping the stack up to date.
Keycloak and Custom Mapper Version Upgrades:
services/keycloak/Dockerfilefrom26.4.7to26.5.7, and updated thekeycloak.versionproperty incustom-mapper/pom.xmlaccordingly. [1] [2]1.1.1to1.1.2in both theDockerfileandpom.xml. [1] [2]Dependency and Plugin Updates:
mariadb-java-clientdependency from3.4.0to3.5.8incustom-mapper/pom.xml.custom-mapper/pom.xml:maven-compiler-pluginfrom3.13.0to3.14.1jandex-maven-pluginfrom3.2.2to3.5.3maven-shade-pluginfrom3.6.0to3.6.2Dockerfilefrom3.9.14-eclipse-temurin-21-alpineto3.9.16-eclipse-temurin-21-alpine.Provider and Extension Updates:
keycloak-home-idp-discoveryprovider JAR from versionv26.1.1tov26.2.0in the Keycloak Dockerfile.