Skip to content

Validate client URLs during partial import - #50146

Closed
MdTanwer wants to merge 1 commit into
keycloak:mainfrom
MdTanwer:fix/50123-validate-client-baseurl-uri-scheme
Closed

Validate client URLs during partial import#50146
MdTanwer wants to merge 1 commit into
keycloak:mainfrom
MdTanwer:fix/50123-validate-client-baseurl-uri-scheme

Conversation

@MdTanwer

Copy link
Copy Markdown
Contributor

Partial import created clients without running ValidationUtil.validateClient, so baseUrl values with disallowed schemes (e.g. javascript:) could bypass checks enforced on Admin API create/update. Run the same validation after client creation in ClientsPartialImport and add a regression test.

Closes #50123

Partial import created clients without running ValidationUtil.validateClient,
so baseUrl values with disallowed schemes (e.g. javascript:) could bypass
checks enforced on Admin API create/update. Run the same validation after
client creation in ClientsPartialImport and add a regression test.

Closes keycloak#50123
@MdTanwer
MdTanwer marked this pull request as ready for review June 19, 2026 06:03
@MdTanwer
MdTanwer requested a review from a team as a code owner June 19, 2026 06:03
Copilot AI review requested due to automatic review settings June 19, 2026 06:03

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.

Pull request overview

This PR closes a validation gap in Keycloak’s partial import flow by ensuring imported clients go through the same client URL validation as Admin API create/update, preventing disallowed URI schemes (e.g., javascript:) in baseUrl from being persisted.

Changes:

  • Run ValidationUtil.validateClient(...) after creating a client during partial import (ClientsPartialImport).
  • Add an integration regression test to assert partial import rejects an illegal baseUrl scheme and does not create the client.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
services/src/main/java/org/keycloak/partialimport/ClientsPartialImport.java Adds client validation after partial-import client creation to enforce illegal-scheme checks.
tests/base/src/test/java/org/keycloak/tests/admin/partialimport/PartialImportClientTest.java Adds a regression test covering illegal-scheme baseUrl rejection during partial import.

Comment on lines +48 to +53
try (Response response = managedRealm.admin().partialImport(piRep)) {
response.bufferEntity();
String body = response.readEntity(String.class);
assertEquals(400, response.getStatus(), body);
assertTrue(body.contains("Base URL uses an illegal scheme"), body);
}
@ahus1

ahus1 commented Jun 19, 2026

Copy link
Copy Markdown
Member

As of CONTRIBUTING.md, "new contributors may have at most 2 open pull requests at a time". Closing this one due to that.

@ahus1 ahus1 closed this Jun 19, 2026
@MdTanwer

MdTanwer commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@ahus1 A humble Request could you pls open this issue ):

@shawkins

shawkins commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@MdTanwer with #50109 closed or put into draft - as we're now simply waiting for the quarkus changes before doing any further keycloak refinements - this can be reopened.

@MdTanwer
MdTanwer deleted the fix/50123-validate-client-baseurl-uri-scheme branch July 10, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client baseUrl URI-scheme validation missing during realm and partial import

4 participants