Skip to content
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

fix(ext/fetch): fix illegal header regex #16236

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Conversation

marcosc90
Copy link
Contributor

This PR fixes invalid header parsing which is flaky because g flag is being used in the regex, which keeps track of lastIndex

try {
  new Headers([["x", "\u0000x"]]);  // error
} catch(e) {}
new Headers([["x", "\u0000x"]]); // no error

This issue affects Response & Request constructors as well

@aapoalas
Copy link
Collaborator

Ooh, nice catch!

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. LGTM, thanks!

@cjihrig cjihrig merged commit 0cd05d7 into denoland:main Oct 10, 2022
@marcosc90 marcosc90 deleted the fix-headers branch October 10, 2022 16:07
bartlomieju pushed a commit that referenced this pull request Oct 17, 2022
This PR fixes invalid header parsing which is flaky because `g` flag is
being used in the regex, which keeps track of `lastIndex`

```javascript
try {
  new Headers([["x", "\u0000x"]]);  // error
} catch(e) {}
new Headers([["x", "\u0000x"]]); // no error
```

This issue affects `Response` & `Request` constructors as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants