Repository navigation
Conversation
c6fc546 to
9584fbe
Compare
|
not recommended by |
I agree that it might not be best practice if production environments but is crucial for development environments, and the linked issue clearly indicate that there’s huge demand for it. It’s also opt-in per realm which means that users will be conscious about enabling it. I can add a popup that says this is not recommended when users try to enable it though. Or maybe we can specify in the realm config the subdomains that are allowed to be wildcarded. |
There’s a separate PR on oAuth2.0 clients where even subpath wildcards are being disabled |
I'd like to offer some counter arguments to this and why I think this PR is heading in a good direction. First, it's being implied that PR #47320 will now disable So as I also commented on #34767, KC by default still allows a single From what I can see (correct me if I'm wrong) this PR aims to implement this based on a flag ( I do agree that a better warning about the risk is a good idea though. I know my opinion probably values very little I'm just a long time user but this one really affects me daily as I have several KC installation as for dynamic test URL I have to always keep a "open wildcard" for all that is a lot more worrying, so I hope you consider this PR for approval. |
87a7e5a to
39dc7e4
Compare
|
Added a follow-up clarification after re-reviewing the opt-in wording and matching rules. The PR now distinguishes runtime wildcard-host matching from client-policy admission control:
I also tightened validation for malformed wildcard-host patterns, including wildcard ports and invalid host labels. The executor help text now says “host wildcard” because one host wildcard can still be combined with an existing trailing path wildcard where Keycloak already allows path wildcards, for example Focused validation run:
|
19d6095 to
6fab262
Compare
6fab262 to
57dbe96
Compare
|
This PR seems to fix an issue introduced by #48430 in 26.6.3. Would appreciate a review on this PR, as there's no workaround short of provisioning a client per MR. |
|
Running into the same issue after upgrading to 26.6.3 because of #48430 . This PR would fix the issue for our use case. A review on this issue would be very much appreciated! |
Add first-label wildcard host matching for redirect URIs, post-logout redirect URIs, and web origins. Gate wildcard-subdomain registration with the secure redirect URIs client policy, reject implicit OAuth2 fallback selection for wildcard-host entries when redirect_uri is omitted, and add service plus Arquillian coverage together with admin and documentation updates. - Validate wildcard redirect hosts to prevent malformed patterns - Clarify wildcard redirect opt-in behavior in admin docs - Update secure redirect URIs executor with wildcard-specific checks - Add CORS, logout, and login-status-iframe test coverage Closes keycloak#34767 Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Abdullah Alaqeel <abdullah.t.aqeel@gmail.com>
Signed-off-by: Abdullah Alaqeel <abdullah.t.aqeel@gmail.com>
57dbe96 to
f938fe9
Compare
|
We're also running in the same issue and would gladly appreciate a review on this. It's blocking our upgrade right now and it's a pain to workaround this issue in the latest version. |
|
Having this solution would be very helpful |
|
Another + 1 for this solution, would be very convenient for us. |
|
+1, this is exactly the gap we hit. Environment: Keycloak 26.7.0 (Keycloak Operator, k8s), realm clients managed declaratively via keycloak-config-cli. Use case: Per-merge-request preview deployments (GitLab CI review apps), e.g. app-mr-.preview.example.com — the MR/branch id is only known at MR-creation time, so it can't be baked into the client config ahead of time. Since #48430 closed the host-boundary bug in 26.6.3, we've had no working wildcard option — https://app-mr-*.preview.example.com/* matches exactly the "wildcard within first label" pattern this PR supports (like your tenant*.example.com), and would replace what's currently a manual, per-preview entry in redirectUris, webOrigins, and post.logout.redirect.uris. Today that means a config-repo commit + redeploy every time someone opens a new preview environment — this PR would let us set it once. |
|
+1 on this PR. We've been looking for native wildcard subdomain support for redirect_uri validation in our multi-tenant setup The centralized approach in RedirectUtils covering logout/iframe origin checks, along with the allow-wildcard-subdomain client policy switch, makes this a safe and complete solution. Looking forward to seeing this merged! |
|
+1 Waiting this for 3 years (use case : platform which generates thousands of temporary webui in the context of an ESA project). |
Summary
This PR implements wildcard subdomain support for Keycloak OIDC redirect URI handling by allowing a single
*in the first DNS label of absolutehttp/httpsURIs.Closes #34767.
Related discussion: #9278.
What changed
RedirectUtilsfor absolutehttp/httpsredirect URIs.https://*.example.com/callback,https://*-preview.example.com/callback, andhttps://tenant*.example.com/callback.allow-wildcard-subdomainto the secure redirect URIs client policy executor and factory. This setting is off by default and controls whether client registration/update requests may include wildcard-host redirect URIs when that executor applies.redirect_uriis omitted.Matching rules
*is supported, and only in the first host label.*matches zero or more non-dot characters and never crosses a label boundary.Why this approach
allow-wildcard-subdomainonly for policies where wildcard-host redirect URI registration should be allowed.Testing
./mvnw -pl services -am -Dtest=RedirectUtilsTest,SecureRedirectUrisEnforcerExecutorTest -Dsurefire.failIfNoSpecifiedTests=false test./mvnw -pl services -am -Dtest=SecureRedirectUrisEnforcerExecutorTest -Dsurefire.failIfNoSpecifiedTests=false testSecureRedirectUrisEnforcerExecutorTestRPInitiatedLogoutTestLoginStatusIframeEndpointTestLogoutCorsTesttestsuite/integration-arquillian/tests/basepackage-phase run because it requires the large distribution and testsuite reactor; the focused tests are included in the PR for CI coverage.AI Usage
This contribution was written with OpenAI Codex from a prompt and then reviewed, revised, and validated by the submitter before opening the PR. I understand the implementation and can follow up on review feedback directly.