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

Swap sanitize for raw when used in Govspeak component #1895

Merged
merged 2 commits into from
Nov 2, 2020

Conversation

injms
Copy link
Contributor

@injms injms commented Nov 2, 2020

What

Replaces sanitise with raw in detailed guide template.

Why

The sanitize method was stripping out tables for reasons. But using sanitizes allow list meant listing most of the HTML elements, and introducing a risk of further breakages if a element is accidently left out of the allow list - so using raw was the least worst compromise between fixing this now, fixing this in the future, and security.

Visual differences

Before:

image

After:

image


⚠️ This application is Continuously Deployed: ⚠️

  • Merged changes are automatically deployed to staging and production.

  • Make sure you follow the guidance for deployments before you merge.

  • Check your branch is being deployed in the Release app, after merging.

The `sanitize` method was stripping out tables for reasons. This replaces it
with the slightly more risky `raw` method that doesn't break the markup. Using
`sanitize`s allow list meant listing most of the HTML elements, and introducing
a risk of further breakages if a element is accidently left out of the
allow list.
@bevanloon bevanloon temporarily deployed to government-f-fix-detail-ylasfp November 2, 2020 15:05 Inactive
Copy link
Contributor

@MahmudH MahmudH left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

@bevanloon bevanloon temporarily deployed to government-f-fix-detail-ylasfp November 2, 2020 15:08 Inactive
@injms injms changed the title Swap sanitize for raw in detail guide template Swap sanitize for raw in Govspeak components Nov 2, 2020
@injms injms changed the title Swap sanitize for raw in Govspeak components Swap sanitize for raw in Govspeak component Nov 2, 2020
@injms injms changed the title Swap sanitize for raw in Govspeak component Swap sanitize for raw when used in Govspeak component Nov 2, 2020
@injms injms merged commit 2b47a4f into master Nov 2, 2020
@injms injms deleted the fix-detailed-guide-govspeak branch November 2, 2020 15:53
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.

3 participants