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

Pass safe HTML to the search component #481

Merged
merged 2 commits into from
Apr 25, 2018
Merged

Conversation

tijmenb
Copy link
Contributor

@tijmenb tijmenb commented Apr 24, 2018

After alphagov/govuk_publishing_components#283 it's no longer possible to pass unsafe HTML to the search component. By using capture we use Rails' escaping and sanitisation mechanism to sanitise @search_term and any other user input.

Also adds a test for the vulnerability fixed in #480.

tijmenb added 2 commits April 24, 2018 15:44
This adds a test for the vulnerability fixed in
#480.

I've confirmed that the test works by removing the `sanitize` call from
the offending string
(https://github.com/alphagov/finder-frontend/blob/4012a62f70b84ce70b55fc
f4b312b0f87e2478cb/app/views/search/_search_field.html.erb#L3).
After alphagov/govuk_publishing_components#283
it's no longer possible to pass unsafe HTML to the search component. By
using `capture` we use Rails' escaping and sanitisation mechanism to
sanitise `@search_term` and any other use input.
@tijmenb tijmenb merged commit 926f48b into master Apr 25, 2018
@tijmenb tijmenb deleted the use-normal-html-for-search branch April 25, 2018 13:42
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