Spurious params framework #1581
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new controller directive, 'spurious_params_ban_ip'. In a controller it would look like this:
You provide to it the names of actions in the current controller, and a list of allowable parameters. If a GET or POST request is made with a bunch of unknown parameters, we know it's not a genuine client, so internally CBRAIN will ban the client's address. This entire mechanism is meant to be useful only for public-facing pages, not for for anything that happens to a logged-in client.
This PR comes with a bunch of pre-defined ban rules for all the public-facing pages.
Currently, to allow so wiggle room, banning happens when at least 3 spurious params are detected.
FOR CODE REVIEWERS: In a dev environement, you'll never end up actually banning yourself, so feel free to try as many weird params as you want. The messages about them will appear in the Rails logs.