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

Sanitise filter parameter values #352

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Sanitise filter parameter values #352

merged 1 commit into from
Nov 27, 2024

Conversation

csutter
Copy link
Contributor

@csutter csutter commented Nov 27, 2024

We occasionally (mostly through pentests) get values for filters that contain random odd Unicode characters. Google's filter logic has failing validations in those cases, causing an error to be raised on the request.

This adds basic, allowlist based sanitisation for all incoming filter values. We know that the values come from a limited character set anyway (slugs and UUIDs), as they are not direct user input.

  • Add value parameter sanitisation for filters
  • Remove existing escape logic in FilterExpressionHelpers (as there should never be any quotes or backslashes in the values to begin with, and we will now have removed them anyway)

We occasionally (mostly through pentests) get values for filters that
contain random odd Unicode characters. Google's filter logic has failing
validations in those cases, causing an error to be raised on the
request.

This adds basic, allowlist based sanitisation for all incoming filter
values. We know that the values come from a limited character set
anyway (slugs and UUIDs), as they are not direct user input.

- Add value parameter sanitisation for filters
- Remove existing escape logic in `FilterExpressionHelpers` (as there
  should never be any quotes or backslashes in the values to begin with,
  and we will now have removed them anyway)
Copy link

@davidgisbey davidgisbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@csutter csutter merged commit eba53a7 into main Nov 27, 2024
8 checks passed
@csutter csutter deleted the param-filter branch November 27, 2024 15:32
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

Successfully merging this pull request may close these issues.

2 participants