-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 10.0.x 6497 alias checkers alt #6681
Conversation
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/SymlinkAllowedResourceAliasChecker.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/SymlinkAllowedResourceAliasChecker.java
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java
Outdated
Show resolved
Hide resolved
@lachlan-roberts let me add some comments and javadoc to clarify my answers above.... |
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
@lachlan-roberts new version pushed. I'm now handling symlinks by constructing the real URI to them and checking that with |
Signed-off-by: Greg Wilkins <gregw@webtide.com>
@joakime I think @lachlan-roberts and I have closed our positions somewhat on this one. Would be good to get your review now. |
I've made this a direct PR to 10.0.x to make reviewing simpler for others. This has changes from both @lachlan-roberts and myself in it |
@joakime @lachlan-roberts nudge |
@joakime your thoughts? |
protected boolean check(String pathInContext, Path path) | ||
{ | ||
// do not allow any file separation characters in the URI, as we need to know exactly what are the segments | ||
if (File.separatorChar != '/' && pathInContext.indexOf(File.separatorChar) >= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be pathInContext.indexOf(File.separatorChar) != -1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that the same thing?
@joakime regardless of if this has been run on windows, do you have any comments on inspecting the code? Is this approach what you were advocating about using the |
The AliasChecker tests passed when I ran them on windows. I ran a full build with tests and had a whole bunch of failures which seem to be unrelated. I've never had a windows build pass all tests locally. But I will take a more detailed look at the windows failures soon for issue #6100. |
Ok, I'll merge tonight unless I hear otherwise. |
* Issue #6497 - Replace the Alias checkers with new implementation. Signed-off-by: Lachlan Roberts <lachlan@webtide.com> Signed-off-by: Greg Wilkins <gregw@webtide.com> Co-authored-by: Lachlan Roberts <lachlan@webtide.com> Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Backport #6681 alias checker changes to Jetty 9.4
An alternative fix for #6497 that avoids using string prefix comparison and instead uses explicit File and Path methods