-
Notifications
You must be signed in to change notification settings - Fork 0
feat: manage bad requests with 'allow request methods' package #1325
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
Conversation
129ba54
to
a9bc6fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great so far, I decided to swoop in with a review on your draft because I think these changes will reduce the number of tests and types you have to write by quite a lot!
e5aac2a
to
d0fd723
Compare
d0fd723
to
ec5a2db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two really small type-related things and then we're ready to go! Exciting :) thanks for all the back and forth on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo! Thanks, let's ship it 🚀 first new package in a while
Current behaviour: a DDoS can use an unexpected HTTP method to bypass the Fastly cache and cause interruption to service. For example, making a request to the homepage as a POST rather than a GET. Express will return a 404 for this error. Ideal future work: If we can transform this 404 error into a 405 Method Not Allowed, we may be able to use Signal Sciences to block this kind of attack very quickly. This is because it’s highly unlikely that a genuine user will accidentally make a POST request. Definition of done for this ticket: Build and release a package containing an Express middleware that applications can consume which will cause unexpected request methods to error with a 405 rather than a 404. See Also: [CPREL-1276]
26d8206
to
00436e7
Compare
Current behaviour: a DDoS can use an unexpected HTTP method to bypass the Fastly cache and cause interruption to service. For example, making a request to the homepage as a POST rather than a GET. Express will return a 404 for this error.
Ideal future work: If we can transform this 404 error into a 405 Method Not Allowed, we may be able to use Signal Sciences to block this kind of attack very quickly. This is because it’s highly unlikely that a genuine user will accidentally make a POST request.
Definition of done for this ticket: Build and release a package containing an Express middleware that applications can consume which will cause unexpected request methods to error with a 405 rather than a 404.
Inspo: https://github.com/rowanmanning/allow-methods/blob/main/index.js
To-Do:
See Also: CPREL-1276