Skip to content

closes #55254 - #55255

Open
himanshi1099 wants to merge 2 commits into
keycloak:mainfrom
himanshi1099:git_55254
Open

himanshi1099 wants to merge 2 commits into
keycloak:mainfrom
himanshi1099:git_55254

Conversation

@himanshi1099

Copy link
Copy Markdown
Contributor

closes #55254

Signed-off-by: Himanshi Gupta <higupta@higupta-thinkpadt14gen5.rmtin.csb>
@himanshi1099
himanshi1099 requested a review from a team as a code owner November 17, 2026 08:01
Copilot AI balanced review requested due to automatic review settings November 17, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Non-breaking spaces prevent server-spi-private from compiling, and realm renames still bypass the new character restrictions.

2 open issues
What changed in this PR

This PR addresses #55254 by adding realm-name validation intended to prevent % and ^ from causing Admin Console failures.

Changes:

  • Adds a realm-specific validator that rejects % and ^ alongside existing reserved characters.
  • Applies the validator during realm creation and import.
File Description
services/​src/​main/​java/​org/​keycloak/​services/​managers/​RealmManager.java Uses realm-name validation for creation and import.
server-spi-private/​src/​main/​java/​org/​keycloak/​utils/​ReservedCharValidator.java Adds the realm-name character restriction and validation method.

Review effort: Balanced

ReservedCharValidator.validate(id);
}
ReservedCharValidator.validate(name);
ReservedCharValidator.validateRealmName(name);
Signed-off-by: Himanshi Gupta <higupta@higupta-thinkpadt14gen5.rmtin.csb>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 08:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Realm updates still use the old validator, allowing existing realms to be renamed with % or ^ and recreating the reported problem.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Realm updates bypass reserved-character validation

server-spi-private/​src/​main/​java/​org/​keycloak/​utils/​ReservedCharValidator.java:72

Realm renames still bypass this restriction: RealmAdminResource.updateRealm() calls ReservedCharValidator.validate(rep.getRealm()), so an existing realm can be renamed to foo% or foo^, recreating the reported problem. Use validateRealmName() in that update path too, and add regression coverage for rejected renames.

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Special characters in Realm name breaks the application

2 participants