Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ELY-2813] Do not decode URI for processing #2204

Closed
wants to merge 398 commits into from

Conversation

michpetrov
Copy link
Contributor

Issue: ELY-2813

fjuma and others added 30 commits October 25, 2023 15:42
[ELY-2687] - Merge an if statement with the enclosing one in ServerAuthen…
[ELY-2682] Refactor OAuth2SaslClientV11Test to use common method
[ELY-2700] - Bump version.com.fasterxml.jackson from 2.15.2 to 2.15.3
[ELY-2650] Upgrade sshd-common from 2.9.2 to 2.10.0
[ELY-2660] Upgrade commons-cli:commons-cli from 1.4 to 1.5.0
[ELY-2681] Refactor OAuth2SaslClientV10Test to use common method
[ELY-2679] Replace assert in VaultCommandTest with a proper check
[ELY-2678] Replace assert in VaultCommandTest with a proper check
[ELY-2672] Upgrade org.kohsuke.metainf-services:metainf-services from…
[ELY-2666] Upgrade org.apache.sshd:sshd-common from 2.9.2 to 2.10.0
[ELY-2671] Upgrade org.jboss.threads:jboss-threads from 2.4.0.Final t…
…LY-2693

[ELY-2693] Unit test code refactor (removed duplicates)
…LY-2684

[ELY-2684] Unit test code refactor (removed duplicates)
[ELY-2661] Upgrade jakarta.enterprise:jakarta.enterprise.cdi-api from 2.0.2 to 4.0.1
…le_repo_readme

[ELY-2647] Add link to elytron-examples in README
…mon method in order to remove duplicated code
[ELY-2669] Upgrade org.jboss.modules:jboss-modules from 1.9.2.Final t…
[ELY-2663] Upgrade org.apache.commons:commons-lang3 from 3.8.1 to 3.13.0
[ELY-2673] Upgrade org.wildfly.common:wildfly-common
[ELY-2664] Upgrade org.apache.httpcomponents:httpclient from 4.5.13 to 4.5.14
@fjuma
Copy link
Contributor

fjuma commented Sep 20, 2024

@michpetrov Thanks for working on this! This looks related to #2186 as well. As commented there, I found this related change that was made for the Keycloak adapter:

keycloak/keycloak#10895

We should make sure that we've incorporated anything else related from the Keycloak PR as well (if you haven't already). For example, the Keycloak adatper supports a couple different cases depending on the Elytron Web version in use and also makes some related changes in other files. We should verify that we can now safely ignore the case where the existing code was needed and also check that we've made the related updates in all places.

Would also be good to add tests.

@michpetrov
Copy link
Contributor Author

@fjuma that seems to be essentially the same problem, so I could close this PR.

I don't quite understand the keycloak PR though, it looks like it's copying the bad behavior from here, i.e. decoding the query and forwarding it as the original and if that's required for elytron-web to function then I'd say there's a problem in elytron-web. But I'm just following a reproducer, I don't know if and when elytron-web comes into play or if that's a separate issue.

@fjuma
Copy link
Contributor

fjuma commented Sep 24, 2024

The original code is needed by Keycloak when using an older version of Elytron Web. The new code is needed by Keycloak when using a newer version of Elytron Web because the newer version updates the way decoding is done.

I can look closer when I have some time to check if there is anything else from the Keycloak PR that is needed.

@michpetrov
Copy link
Contributor Author

So if I'm understanding this right - older versions of elytron-web (anything before 1.9.2 plus 1.10.0 on its own) unintentionally encode the URI when forwarding it, so if Keycloak detects an old version it will decode the URI to fix this. All I'm seeing in the PR are changes to the getUri and getQueryParamValue methods and everything else is just for determining if the workaround should be applied. So if an old version is detected it behaves the way OidcHttpFacade behaves right now, which has been unnecessary (and undesirable) since the elytron-web fix.

Do we want the Keycloak workaround added to Elytron or? I'm seeing elytron-web is already on 4.x so are the old versions still supported?

@fjuma
Copy link
Contributor

fjuma commented Sep 24, 2024

We don't need to worry about the older Elytron Web versions.

I haven't had time to look closely but the handling of the query parameters in the Keycloak code for the new version of Elytron Web looks a bit different from the Elytron code so we need to make sure that part is correct and make sure that we have appropriate tests for this.

@michpetrov
Copy link
Contributor Author

There are some differences (in the UriUtils class). But I guess I'm missing why we're concerned about it, looking at Elytron the method is called to retrieve known parameters (so there isn't a need to make the method handle parameters that are just "key" instead of "key=value" if we know we do not process any such parameters). But if the concern is that Elytron might send unexpectedly encoded/decoded URI to Keycloak or vice versa, this method doesn't modify URI so it wouldn't be the problem.

@michpetrov
Copy link
Contributor Author

[~fjuma], I'd like to expedite this. I can port the method over but like I said I don't think it makes a difference, it doesn't affect the URI that's being exchanged between Elytron and Keycloak.

Copy link
Contributor

@rsearls rsearls left a comment

Choose a reason for hiding this comment

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

This look OK to me.

@michpetrov
Copy link
Contributor Author

Right, this isn't JIRA :) @fjuma, please see my comment above

@darranl
Copy link
Contributor

darranl commented Oct 23, 2024

One small comment, if this is for a micro release this should be submitted against the relevant maintenance branch not 2.x which is the upstream for WildFly.

@ivassile
Copy link
Contributor

ivassile commented Oct 29, 2024

@michpetrov Like @darranl suggested, can you change the PR to target 2.2.x branch (JBEAP-28033)? Thanks!

@michpetrov michpetrov changed the base branch from 2.x to 2.2.x October 29, 2024 13:35
@michpetrov michpetrov closed this Oct 29, 2024
@michpetrov michpetrov deleted the ely-2813 branch October 29, 2024 13:46
@michpetrov michpetrov restored the ely-2813 branch October 29, 2024 13:46
@michpetrov
Copy link
Contributor Author

@ivassile well I tried but I don't think Git is built for that, I've sent a new PR instead - #2236

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.