-
Notifications
You must be signed in to change notification settings - Fork 176
Changed header value validation to accept any ascii except CR & LF #1316
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
Conversation
val.chars().forEach(c -> { | ||
if ((c < 32 && c != 9) || c > 126) { | ||
if (c < 0 || c > 255 || c == 10 || c == 13) { |
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.
char is unsigned, cannot be less than 0. Also, JAVA Charset US-ASCII only takes from 0-127 inclusive. So I think this is right.
if (c > 127 || c == 10 || c == 13) {
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.
I guess the original test went up to 255. Also, I'm in the process of checking with the other client developers to see what they accept (0-127 or 0-255) so we can be consistent.
@francoisprunier A couple things. First, thank you for the bug report and the contribution, this is must appreciated. As soon as I get feedback from the team, I'll let you know if it's 127 or 255, but for Java's sake I hope it's 127 |
Thanks, in the mean time I've updated the MR and used a signed commit. It restricts values to 0-127, I've looked into it and got to https://www.rfc-editor.org/rfc/rfc7230 which states that header values should be us-ascii. The original's RFC used ASCII to mean us-ascii as today's ASCII was called Extended ASCII back then. I'll update the commit if the consensus with other client devs is to use 0-256 anyway. |
Since the go client use a mime processor, I'm going to assume that it follows this RFC standard. I've not gotten much feedback from the team yet, so let's go with the 127 and we can always expand it later. |
Hi @scottf, When do you plan on creating a release with this fix ? It's a blocking issue for us at the moment. Thanks! |
I'm waiting to merge another PR. You can use the 2.21.2-SNAPSHOT for now. Instructions are in the readme, but for gradle/maven you need the snapshot repo Gradle
Maven
|
This is a PR for #1315
Header validation does not accept Form Feed chars (ascii 12) but they're used by the server in some headers, thus breaking the client. This happens on messages fetched from a stream that is sourcing another stream.
The validation now accepts any ascii char except for LR and LF as described in ADR 4.