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

Noteworthy? Insert middleware before ActionDispatch::ParamsParser #99

Closed
2called-chaos opened this issue Oct 24, 2014 · 1 comment
Closed

Comments

@2called-chaos
Copy link

I know this is rails specific but maybe this could be noted somewhere?

I tried to block this with rack-attack: http://stackoverflow.com/questions/25274125/jsonparsererror-n-unexpected-token-at-alihackeval-request-alihack-c

Turned out that the rack-attack middleware is to late to block this request before it breaks.

Solution: Insert the rack-attack middleware before the ParamsParser middelware:

config.middleware.insert_before ActionDispatch::ParamsParser, Rack::Attack
@ktheory
Copy link
Collaborator

ktheory commented Oct 24, 2014

@2called-chaos Thanks, noted. 👌

(Rack::Attack's Readme](https://github.com/kickstarter/rack-attack/blob/25739e24dbc820898cf45d120b1e794e8f6f4df1/README.md#getting-started) inserts the middleware naively.

It's up to app developers to determine the appropriate order of their middleware.

This issue seems like a good note for people googling the issue, but there's nothing to change in Rack::Attack.

Thanks again. 🍻

@ktheory ktheory closed this as completed Oct 24, 2014
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

No branches or pull requests

2 participants