Repository navigation
Verification of iss at refresh token request - #24212
Conversation
|
HI, I've reproduced the issue, and indeed, the iss check is missing during token refresh and during logout with refresh token. To fix the problem, I've added the iss check using the existing TokenVerifier.RealmUrlCheck, with its error message: "Invalid token issuer. Expected X, but was Y." Additionally, I've added a test in the RefreshTokenTest using the ReverseProxy to simulate token refresh from another issuer. Please let me know if this test is unnecessary or invasive. P.S. Using the https url of the ReverseProxy with the OAuthClient seems to be causing a certificate verification issue. I've added a get method in the ReverseProxy to get the proxy http url (to be analyzed, perhaps opening another issue). |
There was a problem hiding this comment.
@Peps14 Nice, Thanks for the PR!
Added one minor inline comment regarding the test.
I think you have good point regarding the explicit error details message. IMO sending back the error response with some values, which were sent in the parameters itself can cause some XSS attacks or other issues in theory. For instance if client applications displays the errorDescription on the page, it can in theory cause trigger the javascript (in case that refresh token is something, which contains some XSS in the issuer field).
Maybe we can revisit this more thoroughly, but for this one, maybe it is OK to just update error message sent by the issuer check, so it contains just something like "Invalid token issuer. Expected X", but no sending back the value of the issuer from the provided refresh-token. WDYT?
There was a problem hiding this comment.
Is it possible to update this to ClassRule to avoid restart undertow server at every test method?
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.x509.X509BrowserCRLTest#loginSuccessWithCRLSignedWithIntermediateCA3FromTruststoreKeycloak CI - FIPS IT (strict) |
|
Hi @mposolda thanks for the review. |
1a32f7a to
2ddb779
Compare
2ddb779 to
a241af8
Compare
|
@Peps14 Thanks! Looks good, besides |
|
Thanks @mposolda, at first look the falling seems to happen when using the FetchOnServer, RunOnServer functions, causing problems in the ReverseProxy in getting system property or java.lang.NoClassDefFoundError: io/undertow/server/HttpHandler. Not yet thoroughly investigated to understand why. |
Added iss checking using the existing TokenVerifier.RealmUrlCheck in the verifyRefreshToken method. Closes keycloak#22191
4 flaky tests on run #9567 ↗︎Details:
|
|||||||||||||||||||||||||||
| Test | Artifacts | |
|---|---|---|
| Realm settings client profiles tab tests > Should not create duplicate client profile |
Output
Screenshots
|
|
clients_test.spec.ts • 2 flaky tests • chrome
realm_settings_general_tab_test.spec.ts • 1 flaky test • chrome
| Test | Artifacts | |
|---|---|---|
| Realm settings general tab tests > Test all general tab switches |
Test Replay
Output
Screenshots
|
|
Review all test suite changes for PR #24212 ↗︎
|
This Change breaks refreshing tokens with dynamic hostnames: Would it be possible to make it configurable, or enable it based on the |
|
@NilsEngelbach Thanks, Can you open a new detailed issue? |
Added iss checking using the existing TokenVerifier.RealmUrlCheck in the verifyRefreshToken method.
Closes #22191