1
0
mirror of https://github.com/keycloak/keycloak.git synced 2026-10-23 19:29:23 +03:00

6526 Commits

Author SHA1 Message Date
Chethann
f7532e1873 Fix partial group import without a path
Look up top-level groups by exact name when the import payload has no path.
Cover plain and slash-containing names under SKIP, OVERWRITE and FAIL.

Closes #53934

Signed-off-by: Chethann <chethankumar0544@gmail.com>
2026-10-22 11:34:44 -03:00
Ricardo Martin
3c07b879d5 Do not assign CURRENT_AUTHENTICATION_EXECUTION on fork
Closes #54176

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-10-21 17:49:14 +02:00
vramik
672f05e258 Require manage-realm to change realm-level default client scopes
Closes #54151

Signed-off-by: vramik <vramik@redhat.com>
2026-10-20 11:40:06 -03:00
vramik
e203767c06 Service account user ID available on client representation instead of exposing separate endpoint returning whole user representation
Closes #54047

Signed-off-by: vramik <vramik@redhat.com>
2026-10-20 10:03:04 -03:00
Lukas Hanusovsky
39e185405b Fix of getting client keystore without private pem.
Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
2026-10-20 14:00:57 +02:00
Alexander Schwartz
7c62788efa Avoid locking when reading lock information from the Admin UI
Closes #54040

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
2026-10-19 20:51:52 +02:00
Alexander Schwartz
8099be0611 Account linking should fire specific event codes
Closes #53636

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-10-19 15:03:24 -03:00
DDINGJOO
082ead23af Fix AccessTokenContext raw token id null check
AccessTokenContext checks grantType twice, so a null rawTokenId argument
bypasses the intended validation. Replace the second check with rawTokenId
and add tests covering all four constructor arguments.

Closes #54051

Signed-off-by: DDINGJOO <173995233+DDINGJOO@users.noreply.github.com>
2026-10-19 19:06:10 +02:00
Václav Muzikář
32d89586d9 Mask secrets in client installations when view-only permissions are used (#53758)
Closes #53751


Signed-off-by: Václav Muzikář <vmuzikar@ibm.com>
2026-10-19 16:29:34 +02:00
Giuseppe Graziano
3fb8fa9dca enforce client authentication for CIBA
Closes #53937

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
2026-10-19 14:38:05 +02:00
Martin Kanis
e61e1e4e02 Deleted required client scope is removed from mixed client-scope policies
Closes #51248

Signed-off-by: Martin Kanis <mkanis@ibm.com>
2026-10-19 09:21:04 -03:00
choksi2212
00c1091165 Reject moving a group under itself or one of its descendants in the Admin API
Both admin REST endpoints that re-parent an existing group accepted a
request to move a group into its own subtree, which created a cycle in
the group hierarchy and made the request fail with an internal error:
JpaRealmProvider.moveGroup re-parented the group and
KeycloakModelUtils.buildGroupPath then recursed up the now-cyclic
parent chain until the stack overflowed, so the Admin API answered
HTTP 500 while the group was not moved (#53936).

GroupResource.addChild and OrganizationGroupResource.addChild now
reject such moves up front with 400 and the message 'Cannot move group
<name> under itself or its descendants', including the degenerate
self-move that previously answered 204 after a silent storage-level
no-op. JpaRealmProvider.moveGroup additionally enforces the same
invariant at the storage level with a ModelValidationException, so
programmatic callers of RealmModel.moveGroup can no longer corrupt
the hierarchy either; the silent no-op for a direct self-move is kept
for backwards compatibility. Moving a group under a parent outside its
own subtree is unchanged.

GroupTest and OrganizationGroupHierarchyTest gain regression tests
covering self-move, direct-child, deeper-descendant rejections, the
unchanged hierarchy afterwards, and a legal move as positive control.

Signed-off-by: choksi2212 <choksi2212@users.noreply.github.com>
2026-10-19 08:51:33 -03:00
Faseela K
2827b3fa10 Clear FreeMarker and gzip caches on theme cache clear() and on startup
Closes #51066

clearCache() only cleared the theme cache, not the FreeMarker template cache or the gzip resource cache, so edited templates/resources kept serving stale content. Now it clears all three.

Also clears the cache from #52802 as suggested on the issue.

Signed-off-by: Faseela K <faseela.k@est.tech>
Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
2026-10-17 16:28:04 +02:00
Stefan Guilhen
6dab41f2e4 Add note to upgrade guide about new enforced validations
- also fix adapter-side validation

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
2026-10-16 15:24:39 -03:00
Stan Silvert
c409798bfc Filter user session and consent client data by client view permission
Viewing a user's sessions, offline sessions and consents only required
permission to view the user, so an admin without view permission on a
client could still read its UUID, clientId and the user's grants for it.
The same leak existed in the Admin UI sessions list and in the other
clients listed in a client's session endpoints.

Fixes #50981

Signed-off-by: Stan Silvert <ssilvert@redhat.com>
Signed-off-by: Tomas Kyjovsky <tkyjovsk@ibm.com>
Co-authored-by: Tomas Kyjovsky <tkyjovsk@ibm.com>
2026-10-16 19:30:01 +02:00
choksi2212
1e7f8e8cc8 Give the forwarded prompt=none precedence over the IDP-configured prompt
When a client sends prompt=none and the identity provider accepts passive
login forwards from the client, the broker forwards the passive login to the
IDP. The prompt parameter of the resulting authorization request was however
built from the identity provider configuration alone, so an IDP configured
with its own prompt (e.g. login) silently suppressed the forwarded
prompt=none: instead of being logged in silently, the user was sent through
an interactive login, and the expected passive-login error semantics
(login_required / interaction_required) were lost.

Give the forwarded passive login precedence over the IDP-configured prompt,
so the authorization request sent to the IDP always carries prompt=none when
the passive login was forwarded.

Also remove the @Ignore from KcOidcBrokerPromptNoneRedirectTest now that the
tests pass again: the assertions still expected the 2019 account console URL
shape (/account/?error=...) while the account console now lives at
/account?error=..., and add a regression test proving the forwarded
prompt=none wins over an IDP-configured prompt=login.

Closes #53865
Closes #20642

Signed-off-by: choksi2212 <choksi2212@users.noreply.github.com>
2026-10-15 12:12:37 -03:00
Atiqur Rahman
9ad98e7834 Set default Bearer token_type in broker token responses
Closes #53954

Signed-off-by: Atiqur Rahman <rahman.atiqur.pro@gmail.com>
2026-10-15 11:10:15 -03:00
Ricardo Martin
bbd76c6017 Check kc_locale param is among the allowed locales in the realm
Closes #53999

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-10-15 15:29:05 +02:00
Cornelius Roemer
252e0b5a42 Replace cached gzip theme resources atomically (#53239)
* Replace cached gzip theme resources atomically

Concurrent first requests for a theme resource each gzip it to a temp
file and move it over the cached copy. Without ATOMIC_MOVE the JDK
replaces an existing target by deleting it and then renaming, so a
request opening the file in between gets FileNotFoundException (and on
JDK 17 a second mover's own delete can fail with NoSuchFileException).
getEncodedStream then returns null and the resource is answered with
404.

Publish the cache file only by an ATOMIC_MOVE of the completed temp
file, which is in the target's directory, so a cached file that exists
is always complete. On POSIX this is a rename(2) that replaces the
target in one step; on Windows it is a MoveFileEx replace, which fails
while another request has the target open. Racing requests all write
the same content, so if the move fails and the target exists, serve
that target. If the move fails and there is no target, serve this
request's gzipped bytes from memory without caching them. The temp
file is deleted whenever the move fails, and a failed delete does not
fail the request.

GzipResourceEncodingProviderTest has 16 threads request the same
uncached resource at once, over 100 rounds, and checks that every one
gets a stream that decompresses to the original content.

Closes #53238

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cornelius Roemer <cornelius.roemer@gmail.com>

* Falls back to original resource when encoding fails

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

---------

Signed-off-by: Cornelius Roemer <cornelius.roemer@gmail.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Martin Bartoš <mabartos@redhat.com>
2026-10-15 12:26:24 +02:00
vramik
c104900549 Treat the admin-permissions client as an internal client
Closes #51630

Co-authored-by: waterWang <waterwang@users.noreply.github.com>
Signed-off-by: vramik <vramik@redhat.com>
2026-10-14 08:02:36 -03:00
Martin Kanis
77b0ffa825 Unverified broker email can satisfy an organization domain gate (#53858)
* Unverified broker email can satisfy an organization domain gate

Closes #53815

Signed-off-by: Martin Kanis <mkanis@ibm.com>
2026-10-14 07:59:58 -03:00
Martin Kanis
19c5879a4a Realm client-session stats disclose hidden clients under FGAP v2
Closes #50917

Signed-off-by: Martin Kanis <mkanis@ibm.com>
2026-10-14 07:48:46 -03:00
Michal Vavřík
3e0fda9765 prevent kcSanitize from re-activating disallowed URL schemes after link fixup
closes: github.com/keycloak/keycloak/issues/53813

Signed-off-by: Michal Vavřík <dev@michalvavrik.net>
2026-10-14 10:40:55 +02:00
TheSudo
46b9e8878e Import all PEM certificates with BCFIPS (#53613)
* Import all PEM certificates with BCFIPS

Closes #53612

Signed-off-by: josh-tracy <josh.tracy@defenseunicorns.com>

* Import all certificates from PEM bundles

Signed-off-by: josh-tracy <josh.tracy@defenseunicorns.com>

---------

Signed-off-by: josh-tracy <josh.tracy@defenseunicorns.com>
2026-10-13 19:43:28 +02:00
Giuseppe Graziano
f505504307 ssfr check for cimd
Closes #53812

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
2026-10-13 16:06:13 +02:00
Stefan Guilhen
57e34463ee Fix V2 broker token endpoint to refresh expired external IDP tokens
Fix V2 broker token endpoint to refresh expired external IDP tokens

When retrieving external OAuth2 access tokens via POST /broker/{alias}/token,
expired tokens are now automatically refreshed when a refresh_token is available.
The response includes expiresIn so callers can determine token lifetime.
Supports all token storage configurations (DB-only, session-only, both, neither).

Closes keycloak#49317
2026-10-13 09:54:57 -03:00
Steven Hawkins
c00a92ee21 fix: addressing the copy paste error in DescriptionConverter (#53754)
closes: #53749

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
2026-10-13 12:52:53 +00:00
Alexander Schwartz
ffdba37767 Avoid firing duplicate events and responses with user provided content from IDP
Closes #53634

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-10-13 08:51:43 -03:00
Thomas Darimont
da800c322b Emit CaepSessionRevoked when an admin deletes a single user session (#53627) (#53630)
* Emit CaepSessionRevoked when an admin deletes a single user session (#53627)

DELETE /admin/realms/{realm}/sessions/{id} (the per-session "Sign out" in the
admin console) fired only a ResourceType.USER_SESSION admin event, which the
SSF transmitter ignored, and backchannelLogout emits no LOGOUT user event.

RealmAdminResource.deleteSession now attaches the session's user as the
Details.USER_ID admin event detail (the path only names the session, which
is already removed when listeners run). The SSF mapper maps that event to a
synthetic LOGOUT carrying the concrete session id, so the resulting
CaepSessionRevoked SET names exactly the revoked session.

Also pass the admin event through for "log out all user sessions" so its
SET reports initiating_entity admin instead of user.

Fixes #53627

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

* SSF: Document why admin session deletion skips the liveness check

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>

---------

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
2026-10-13 07:49:31 -04:00
Peter Zaoral
88fc7659e8 Fix certificate validation ordering in X509ClientAuthenticator to match browser authenticators (#53596)
Closes: #53593

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
2026-10-13 12:36:06 +02:00
mposolda
6bc5146087 JWE key-management algorithm not validated against provisioned key algorithm on request object decryption
closes #52104

Signed-off-by: mposolda <mposolda@gmail.com>
2026-10-13 11:15:58 +02:00
Erik Jan de Wit
4c3aaed150 Require client signature for SAML SessionIndex back-channel SLO (#53658)
Closes #53535.


Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2026-10-13 09:19:38 +02:00
Alexander Schwartz
7790669562 Adjust the timeouts to allow for a retry after a ISPN000427
Closes #53809

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
2026-10-12 18:25:23 +02:00
Erik Jan de Wit
bd6da60f46 [CVE-2026-105305] Enforce client minimum ACR in Device Authorization Grant (#53779)
* Enforce client minimum ACR in Device Authorization Grant

Device verification never set REQUESTED_LEVEL_OF_AUTHENTICATION, so
minimum.acr.value and default.acr.values were ignored.

Closes #53618
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Use dedicated ACR user and assert pending token in device grant test

Avoid attaching TOTP to the shared device-login user, and verify the
device token endpoint returns authorization_pending until OTP completes.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Apply client default/minimum ACR for CIBA backchannel requests

BackchannelAuthenticationEndpoint only forwarded explicit acr_values,
so client minimum.acr.value and default.acr.values were ignored. Also
add a CIBATest covering the minimum ACR being passed to the auth channel.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Fix device ACR test compile after TimeOffSet API change

Use timeOffSet.set() instead of the removed setTimeOffset/resetTimeOffset helpers.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Keep device ACR test under deprecated testsuite line limit

The Testsuite Deprecation Check rejects >=100 additions per file;
compact the new minimum-ACR coverage so CI can pass.

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

---------

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2026-10-12 14:43:32 +02:00
Justin
a5f2ca3b71 Emit admin event when creating a UMA policy via the Protection API
UserManagedPermissionService.create() saved the policy through PolicyService.create(AbstractPolicyRepresentation), which skips the audit call, so no AUTHORIZATION_POLICY CREATE admin event was recorded. The CREATE event now uses the same resource path as the existing UPDATE and DELETE events.

Closes #20008

Signed-off-by: Justin Brueggemann <167224505+JBoogieman@users.noreply.github.com>
2026-10-12 10:15:55 +02:00
Ricardo Martin
ebde947d75 Fix session-limit denial wrongly triggering brute force
Closes #44474

Signed-off-by: Sabeer Muhaiadeen N <99068582+sabeer02@users.noreply.github.com>
Signed-off-by: rmartinc <rmartinc@redhat.com>
Co-authored-by: Sabeer Muhaiadeen N <99068582+sabeer02@users.noreply.github.com>
2026-10-10 17:25:15 +02:00
Martin Kanis
eb6d2ddecd Organizations: Invitation link can be used by multiple users due to missing single-use check
Closes #49786

Signed-off-by: Martin Kanis <mkanis@ibm.com>
2026-10-09 15:34:59 -03:00
Erik Jan de Wit
351a4e9f7b fixes CVE-2026-92358 by removing stale SUO proof (#53418)
fixes: #53061

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2026-10-09 13:43:23 +00:00
Erik Jan de Wit
17e1425ab6 fixes CVE-2026-15943 by dropping when other values are changed (#53411)
* fixes CVE-2026-15943 by dropping when other values are changed

fixes: #50945
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2026-10-09 08:18:21 -03:00
Luca Tronchin
8539464b05 Resolve properties in the notify-user step subject
Closes #53312

The subject of the notify-user step was passed to the email provider
verbatim, where it ends up as a java.text.MessageFormat pattern when it
does not match a key from the email theme message bundle. A subject such
as "${user.firstName}, log in to keep your account active" therefore
failed with:

    IllegalArgumentException: can't parse argument number: user.firstName

The email was never sent, the step was still marked as completed, and
the following steps of the workflow ran as usual.

Resolve properties in the subject with the same resolver already used
for the custom message, and escape the resulting text so that it is not
interpreted as a MessageFormat pattern. Escaping is a no-op for a text
without MessageFormat meta characters, so a subject referencing a key
from the message bundle keeps being resolved and localized as before.
It also makes a subject with a single quote, like "your account's
review", keep its quote instead of silently losing it.

Signed-off-by: Luca Tronchin <ltronky@gmail.com>
2026-10-09 08:07:58 -03:00
Pedro Igor
c7de391ae4 Filter role mappings by visibility in full group listings
Closes #53265

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
2026-10-08 22:39:05 +02:00
Oluwatobi Mustapha
0c006cec11 Restrict Twitter request token deserialization (#51750)
Closes #51377

Signed-off-by: Oluwatobi Mustapha <oluwatobimustapha539@gmail.com>
2026-10-08 15:14:53 -04:00
Ricardo Martin
8d330a06b5 Limit the size in CRL and OCSP http responses (#53697)
Closes #52063

Signed-off-by: rmartinc <rmartinc@redhat.com>
2026-10-08 13:28:53 +02:00
Martin Bartoš
72baa368c1 Username enumeration via empty-password timing
Closes #51887

Co-authored-by: Tarantula471 <singhtushar956@gmail.com>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>
2026-10-08 11:12:34 +02:00
Olivier Boudet
ad732f9dad fix(broker): Allows cross session email validation (#52604) (#52626)
* fix(broker): Allows cross session email validation (#52604)

Allows cross session email validation when using IdpDetectExistingBrokerUserAuthentication instead of IdpCreateUserIfUniqueAuthenticator

Signed-off-by: Olivier Boudet <o.boudet@gmail.com>

* fix priority

Signed-off-by: Olivier Boudet <o.boudet@gmail.com>

---------

Signed-off-by: Olivier Boudet <o.boudet@gmail.com>
2026-10-08 11:00:22 +02:00
Erik Jan de Wit
a666b23f71 Require STARTTLS when SMTP starttls is enabled (#53675)
Prevent opportunistic STARTTLS downgrade attacks by setting
mail.smtp.starttls.required=true whenever starttls is configured,
so AUTH and message data are never sent in plaintext.

Closes #53674

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2026-10-07 18:34:30 +02:00
vramik
4c746a54c6 Organization invitation redirectUrl is not validated against the account client allowlist, leaking a new user's authorization code
Closes #53058

Signed-off-by: vramik <vramik@redhat.com>
2026-10-07 09:12:23 -03:00
m3l4n0ff
0a4c44b234 Fix missing canView() filter in /role-mappings/realm endpoints
getRealmRoleMappings() and getCompositeRealmRoleMappings() were missing
the per-role auth.roles().canView() filter that getRoleMappings() already
applied. A narrow admin with only view-user permission could enumerate
every realm role assigned to a user or group through the /realm and
/realm/composite siblings, even though the combined /role-mappings endpoint
correctly hid them.

Added the missing filter to both methods and a regression test that verifies
all three endpoints behave consistently.

Closes #52399

Signed-off-by: m3l4n0ff <y.zendour2@gmail.com>
2026-10-07 08:35:53 -03:00
Martin Bartoš
fe6ca89ca5 Token introspection omits act claim for token-exchange delegation tokens
Closes #53029

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
2026-10-07 13:07:31 +02:00
Michal Vavřík
78719c4127 fix: filter scope mapping listings by role visibility
closes: https://github.com/keycloak/keycloak/issues/53480

Signed-off-by: Michal Vavřík <dev@michalvavrik.net>
2026-10-07 07:45:19 -03:00