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

Jetty 12.0.x 9444 servlet paths fully decoded #9479

Merged
merged 11 commits into from
Mar 11, 2023

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Mar 8, 2023

Alternative to #9465
This is an alternative to #9462 & #9465 as a fix for #9444, replacing changes made by #9455

gregw added 4 commits March 8, 2023 17:27
getServletPath and getPathInfo will never return an encoded path segment. Instead, they will throw an IllegalArgumentException if they are called when there is a URI with violations.
getServletPath and getPathInfo will never return an encoded path segment. Instead, they will throw an IllegalArgumentException if they are called when there is a URI with violations.
Signed-off-by: gregw <[email protected]>
@gregw gregw mentioned this pull request Mar 9, 2023
@gregw
Copy link
Contributor Author

gregw commented Mar 9, 2023

@joakime do you think there are any tests from #9462 that should be kept even without safeDecode in this PR?

Fixed ee9 tests
@gregw gregw marked this pull request as ready for review March 9, 2023 11:34
@gregw gregw requested review from joakime, sbordet and janbartel March 9, 2023 11:36
@gregw
Copy link
Contributor Author

gregw commented Mar 9, 2023

@sbordet @janbartel @joakime this PR is now building and so is ready for some review, however I think there is still some more work that could be done:

  • Need to merge the BadMessage/HttpException PR so we can correctly throw an IAE rather than a RTE
  • We could potentially make throwing the IAE configurable, so an app could both allow the violation and allow the ambiguous decoding. The question is, where should that configuration be?
  • probably more renaming could be done to distinguish between encodedPathInContext and decodedPathInContext. Any ideas for better names for those?
  • there are some related unit tests that are disabled. They should be re-enabled and debugged (edit: turned out they were cross context dispatch)

@gregw
Copy link
Contributor Author

gregw commented Mar 9, 2023

How about we use canonicalPathInContext instead of encodedPathInContext and then just used pathInContext for the decodedPathInContext?

Optionally throw on decode of ambiguous URIs
@joakime
Copy link
Contributor

joakime commented Mar 9, 2023

How about we use canonicalPathInContext instead of encodedPathInContext and then just used pathInContext for the decodedPathInContext?

I'd prefer that we keep the "encoded" and "decoded" portions in the method names.

gregw added 2 commits March 10, 2023 09:59
Optionally throw on decode of ambiguous URIs
@joakime
Copy link
Contributor

joakime commented Mar 10, 2023

We'll get rid of the ISO-8859-1 fallback during decode in a different PR?

@joakime
Copy link
Contributor

joakime commented Mar 10, 2023

@gregw I added some more URIUtilTest cases, and a block of tests that are commented out for a future PR.
I'm onboard with this PR once the concerns from @sbordet are addressed.

updates from review. Extra testing.
@gregw gregw requested a review from sbordet March 10, 2023 17:49
Copy link
Contributor

@sbordet sbordet left a comment

Choose a reason for hiding this comment

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

Just nits, LGTM.

updates from review.
@gregw gregw merged commit bd0186c into jetty-12.0.x Mar 11, 2023
@gregw gregw deleted the jetty-12.0.x-9444-servletPaths-fully-decoded branch March 11, 2023 13:13
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.

3 participants