Detect and trim any invalid incoming req header name#1276
Open
dino-brzika wants to merge 3 commits intohttp-party:masterfrom
Open
Detect and trim any invalid incoming req header name#1276dino-brzika wants to merge 3 commits intohttp-party:masterfrom
dino-brzika wants to merge 3 commits intohttp-party:masterfrom
Conversation
added 3 commits
June 20, 2018 12:38
…ith dash to preserve header in correct format
Codecov Report
@@ Coverage Diff @@
## master #1276 +/- ##
=========================================
Coverage ? 92.54%
=========================================
Files ? 6
Lines ? 322
Branches ? 0
=========================================
Hits ? 298
Misses ? 24
Partials ? 0
Continue to review full report at Codecov.
|
58 tasks
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.
Issue #1261
In web-incoming.js it is not handled if incoming req header name start or end with whitespace.
Result is crashing of application. Issue is easy to reproduce by manually adding in req headers header with whitespace (example 'cookie '). In production issue is observed on node 4.8.0 and http-proxy 1.16.2 version. Application is build in Meteor which does not handle this as well.
Submitted solution is to loop through req headers and when invalid header is detected, add new header with trimmed name and remove existing invalid header. In addition to this it will replace remaining whitespaces with dash(-). This is needed in order to handle case where header is named like "foo bar".
Fix verified on node 4.8.0 and all tests passed.