Proper header production#357
Merged
alexindigo merged 1 commit intoform-data:masterfrom Jun 16, 2017
Merged
Conversation
the existing code uses a for loop to iterate through headers but does not check that the values are actually properties, therefore it picks up methods. these methods can appear as they are defined within the Object.prototype and including them in the headers breaks requests as the stringified methods likely contain carriage returns, which breaks the request due to malformation of the header in general, it is better to use Object.keys(headers).forEach() but I didn’t want to change the style of the code so a call to .hasOwnProperty() solves the problem
Author
|
as added documentation, submitting a malformed header breaks the server like this: |
Member
|
Looks good. Thanks for the fix. |
Member
|
Will publish updated version later tonight. |
Author
|
I didn't review the entire codebase but you might want to look for similar uses of the for loop |
Member
|
Ok, I will check for more. Thanks. |
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.
the existing code uses a for loop to iterate through headers but does
not check that the values are actually properties, therefore it picks
up methods. these methods can appear as they are defined within the
Object.prototype and including them in the headers breaks requests as
the stringified methods likely contain carriage returns, which breaks
the request due to malformation of the header
in general, it is better to use Object.keys(headers).forEach() but I
didn’t want to change the style of the code so a call to
.hasOwnProperty() solves the problem