-
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
Issue #8716 - Handle bad host/authority headers better #8717
Conversation
Signed-off-by: Joakim Erdfelt <[email protected]>
…t headers Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime @gregw I'm on the fence about this PR. I think we should fix the double If someone sends Looking for |
Signed-off-by: Joakim Erdfelt <[email protected]>
jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java
Show resolved
Hide resolved
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
…invalid-host-headers
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.
Looks good... but we can make the isRegName more efficient with a lookup table.
Signed-off-by: Joakim Erdfelt <[email protected]>
|
||
static | ||
{ | ||
REGNAME_ALLOWED = new boolean[127]; |
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.
Should be 128.
REGNAME_ALLOWED[c] = true; | ||
} | ||
} | ||
|
||
// Use UTF-8 as per http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars | ||
public static final Charset __CHARSET = StandardCharsets.UTF_8; |
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.
Make private
and possibly remove the constant altogether.
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.
Cool, lemme do this in a different PR
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.
Actually, can't do this for Jetty 10.0.x (where this PR is).
BUT I will do it for Jetty 12.0.x
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.
Took care of this (along with other URIUtil cleanup) in jetty-12.0.x
PR #8861
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
…invalid-host-headers
…invalid-host-headers
…invalid-host-headers
This is a minimal version of code to reject bad Host/authority header usage.
The more robust validation can be found in the closed (and never merged) PR #7279
Signed-off-by: Joakim Erdfelt [email protected]