MBS-13914: Validate vote arguments for voter edit search #3464
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.
Fix MBS-13914
Problem
A link such as
/search/edits?conditions.0.args=&conditions.0.field=voter&conditions.0.name=aerozol&conditions.0.operator=%3D&conditions.0.voter_id=463559
causes an ISE when logged in - it seems to be caused by the emptyconditions.0.args=
leading to an emptyWHERE ()
in the query. It seems this can probably only be hit by manually editing the URL (since just deselecting all the vote options removesargs
entirely and was already being caught as invalid).Solution
It seems any argument that is not a valid vote option or "no" (which we use for searching for lack of votes) should just be deemed invalid and reject the search, so this checks the arguments against the valid list and rejects any that don't match.
Testing
Manually.