Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Conversation

@jasnell
Copy link
Member

@jasnell jasnell commented Jan 5, 2015

Per #8947, the http.request constructor is not properly checking the validity
of the HTTP method input by the user. The problem allowed HTTP request
headers to be injected via the method option as reported in #8947. This fixes
the problem by introducing a quick check against a the HTTP token rule to
ensure that the method is valid.

Per nodejs#8947 .

* Check that the passed in method conforms to the token rule.
* If the specified method does not conform, throw.

Likely would be a good idea to check other bits this way also.
@misterdjules
Copy link

Thanks for the PR. I'm not sure if this is the best way to fix this issue, but I have a few comments regarding the PR itself though.

  • It should target the oldest branch that is affected by the issue, in this case v0.10. You might have to close this PR and reopen a new one to change the target branch.
  • The commits should be squashed into one commit.
  • The commit message should conform to the guidelines.
  • The PR's title should not contain a specific version number.

Hopefully we'll be able to review the code changes themselves soon. Thank you again!

@jasnell
Copy link
Member Author

jasnell commented Jan 7, 2015

Yep, another approach is to scan through each char and throw on the first non-token char (or not throw and fallback to the default, which seems bad too).

(I thought I had squashed those commits together... how odd. Will retarget this to v0.10 tomorrow and resubmit.)

@misterdjules
Copy link

Another thing I failed to mention previously is that we'd need to have tests for this change.

@jasnell
Copy link
Member Author

jasnell commented Jan 12, 2015

Replacing with .. #9017

@jasnell jasnell closed this Jan 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants