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

Improve alias checking in PathResource #6473

Closed
gregw opened this issue Jun 26, 2021 · 1 comment · Fixed by #6474
Closed

Improve alias checking in PathResource #6473

gregw opened this issue Jun 26, 2021 · 1 comment · Fixed by #6474

Comments

@gregw
Copy link
Contributor

gregw commented Jun 26, 2021

Target Jetty version(s)
9.10,11

Enhancement Description

Currently multiple calls to canonicalPath are done, which is inefficient repeat scanning. Include normalization in alias checks, as was previously done in FileResource, so that only a single normalization pass is needed.

@gregw gregw changed the title Improve alias checking in Improve alias checking in PathResource Jun 26, 2021
@gregw gregw linked a pull request Jun 26, 2021 that will close this issue
@gregw gregw added this to To do in Jetty 9.4.43 FROZEN via automation Jun 26, 2021
@gregw gregw added this to To do in Jetty 10.0.6/11.0.6 FROZEN via automation Jun 26, 2021
lachlan-roberts added a commit that referenced this issue Jun 27, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit that referenced this issue Jun 28, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw added a commit that referenced this issue Jun 28, 2021
#6474)

Reduce multiple canonicalPath calls with single alias check in PathResource
Revert to decoding and the normalizing URLs so that subsequent canonicalPath calls are noops. 
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
sbordet added a commit that referenced this issue Jun 28, 2021
* Reverted %-escape handling for URI query parts.
* Performing canonicalization in ServletContext.getResource(),
  and improving alias checking in ContextHandler.getResource().
* Performing canonicalization checks in Resource.addPath() to avoid
  navigation above of the root.
* Test added and fixed.
* Various cleanups.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
lachlan-roberts added a commit that referenced this issue Jun 29, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw pushed a commit that referenced this issue Jun 29, 2021
* Reverted %-escape handling for URI query parts.
* Performing canonicalization in ServletContext.getResource(),
  and improving alias checking in ContextHandler.getResource().
* Performing canonicalization checks in Resource.addPath() to avoid
  navigation above of the root.
* Test added and fixed.
* Various cleanups.
* Improved javadoc and comments

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
lachlan-roberts pushed a commit that referenced this issue Jun 29, 2021
* Reverted %-escape handling for URI query parts.
* Performing canonicalization in ServletContext.getResource(),
  and improving alias checking in ContextHandler.getResource().
* Performing canonicalization checks in Resource.addPath() to avoid
  navigation above of the root.
* Test added and fixed.
* Various cleanups.
* Improved javadoc and comments

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
sbordet added a commit that referenced this issue Jun 29, 2021
* Issue #6473 - Improve alias checking in PathResource.

* Reverted %-escape handling for URI query parts.
* Performing canonicalization in ServletContext.getResource(),
  and improving alias checking in ContextHandler.getResource().
* Performing canonicalization checks in Resource.addPath() to avoid
  navigation above of the root.
* Test added and fixed.
* Various cleanups.
* Improved javadoc and comments

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
sbordet pushed a commit that referenced this issue Jun 29, 2021
…e (Jetty-10) (#6478)

Issue #6473 - canonicalPath refactor & fix alias check in PathResource

* Reverted %-escape handling for URI query parts.
* Performing canonicalization in ServletContext.getResource(),
  and improving alias checking in ContextHandler.getResource().
* Performing canonicalization checks in Resource.addPath() to avoid
  navigation above of the root.
* Test added and fixed.
* Various cleanups.
* Improved javadoc and comments
* Compliance mode HttpURI uses UriCompliance.Violation

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw moved this from To do to Done in Jetty 9.4.43 FROZEN Jul 1, 2021
@gregw gregw moved this from To do to Done in Jetty 10.0.6/11.0.6 FROZEN Jul 1, 2021
@lachlan-roberts
Copy link
Contributor

This is done in both the 9.4.43 project and the 10.0.6/11.0.6 project so I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants