Sanitize UTF8 characters from headers#1674
Merged
Conversation
7c00e17 to
f58943f
Compare
spec/requests/headers_spec.rb
Outdated
Contributor
There was a problem hiding this comment.
this might be the wrong header to test because we delete the entire header?
Contributor
Author
There was a problem hiding this comment.
I changed up this spec so that it doesn't use the Host header. Mind taking another look?
zachmargolis
approved these changes
Sep 15, 2017
Contributor
zachmargolis
left a comment
There was a problem hiding this comment.
LGTM! Thanks for fixing
289d3de to
759f522
Compare
**Why**: Rack encodes headers into 8 bit ASCII which results in encoding compadibility errors futher down the stack when the app tries to manipulate them. This commit encodes the headers and replaces incompatible characters with `?` characters so the headers do not cause the app to respond with 500s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why: Rack encodes headers into 8 bit ASCII which results in encoding
compatibility errors further down the stack when the app tries to
manipulate them. This commit encodes the headers and replaces
incompatible characters with
?characters so the headers do not causethe app to respond with 500s.