-
Notifications
You must be signed in to change notification settings - Fork 7
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 the search term before rendering #480
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using the unsanitised search term in the “Search results for” text could result in an XSS vulnerability.
pmanrubia
approved these changes
Apr 24, 2018
tijmenb
added a commit
to alphagov/govuk_publishing_components
that referenced
this pull request
Apr 24, 2018
The use of `html_safe` here caused a XSS vulnerability. It is currently fixed in finder-frontend (alphagov/finder-frontend#480). It's also possible to insert HTML without doing html_safe by using a capture block, so to avoid recurrence of the bug we'll remove `html_safe` here entirely.
tijmenb
added a commit
that referenced
this pull request
Apr 24, 2018
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).
kevindew
added a commit
that referenced
this pull request
Jun 29, 2022
This imports a test from Smokey that confirmed Finder Frontend doesn't have execute JavaScript that is inputted by a user [1]. This has been ported because this testing can and should be localised to this application and doesn't need to be done in a wider, distinct suite. It does seem unusual to have a test of this sort of low-level concern at a feature level, because it is not a feature. However given we've had at-least 2 incidents related to XSS in Finder Frontend [2], [3] it seems like something we should check. As a feature test operates in a real browser environment this is the only place we can have high confidence that input doesn't cause unexpected JavaScript execution. This test doesn't check the server side handling of XSS a separate change is being added for that. In order to make these tests work and not had a whole bunch of new steps I had to do some wrestling with the step definitions. They don't seem to be in a good state, so I just tried to do minimal damage and keep it all running. [1]: https://github.com/alphagov/smokey/blob/7553a432259d785fb6d4fb81cfd4fe3572185ad3/features/apps/finder_frontend.feature#L11-L31 [2]: #480 [3]: #1060
kevindew
added a commit
that referenced
this pull request
Jun 30, 2022
This imports a test from Smokey that confirmed Finder Frontend doesn't have execute JavaScript that is inputted by a user [1]. This has been ported because this testing can and should be localised to this application and doesn't need to be done in a wider, distinct suite. It does seem unusual to have a test of this sort of low-level concern at a feature level, because it is not a feature. However given we've had at-least 2 incidents related to XSS in Finder Frontend [2], [3] it seems like something we should check. As a feature test operates in a real browser environment this is the only place we can have high confidence that input doesn't cause unexpected JavaScript execution. This test doesn't check the server side handling of XSS a separate change is being added for that. In order to make these tests work and not had a whole bunch of new steps I had to do some wrestling with the step definitions. They don't seem to be in a good state, so I just tried to do minimal damage and keep it all running. [1]: https://github.com/alphagov/smokey/blob/7553a432259d785fb6d4fb81cfd4fe3572185ad3/features/apps/finder_frontend.feature#L11-L31 [2]: #480 [3]: #1060
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Using the unsanitised search term in the “Search results for” text
could result in an XSS vulnerability.