Validate client URLs during partial import - #50146
Closed
MdTanwer wants to merge 1 commit into
Closed
Conversation
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
Contributor
There was a problem hiding this comment.
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
baseUrlscheme 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); | ||
| } |
Member
|
As of CONTRIBUTING.md, "new contributors may have at most 2 open pull requests at a time". Closing this one due to that. |
Contributor
Author
|
@ahus1 A humble Request could you pls open this issue ): |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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