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

Cleanup Mime::Type Regexp #42177

Merged
merged 3 commits into from
May 12, 2021
Merged

Cleanup Mime::Type Regexp #42177

merged 3 commits into from
May 12, 2021

Conversation

eregon
Copy link
Contributor

@eregon eregon commented May 8, 2021

Summary

I was curious about https://discuss.rubyonrails.org/t/cve-2021-22902-possible-denial-of-service-vulnerability-in-action-dispatch/77866 and looking a bit into I noticed several cleanups for those regexps.

This is likely easier to review commit-by-commit.

eregon added 3 commits May 8, 2021 20:07
* There is already \s* at the start of MIME_PARAMETER, and we only need a \s* at the end.
* This on its own already fixes the excessive backtracking for the example in
  https://discuss.rubyonrails.org/t/cve-2021-22902-possible-denial-of-service-vulnerability-in-action-dispatch/77866
* The atomic group is kept because we never need to backtrack there and it's more future-proof.
@rails-bot rails-bot bot added the actionpack label May 8, 2021
@byroot byroot merged commit 0e6e3b0 into rails:main May 12, 2021
@eregon eregon deleted the cleanup-mime-regexps branch May 12, 2021 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants