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

Add notice about the use of html arguments in Nunjucks macros for production #785

Merged
merged 3 commits into from
Jun 18, 2018

Conversation

kr8n3r
Copy link

@kr8n3r kr8n3r commented Jun 13, 2018

We need to make developers aware that if they decide to use Nunjucks macros in production and use html arguments or ones ending in Html that render unescaped html, making it a security risk

This adds notice text before and after the table of arguments in the README file for each component.
Text is set as a variable, so it can be updated in a single place if required.

Part of this Trello ticket:
https://trello.com/c/SruPShLz/1049-add-clearer-documentation-around-text-vs-html-in-nunjucks-macros

Adresses: #514

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 13, 2018 10:37 Inactive
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 9385fb5 to fcdd77b Compare June 13, 2018 21:22
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 13, 2018 21:22 Inactive
@kr8n3r kr8n3r changed the title WIP: Add notice about the use of html arguments in Nunjucks macros for production Add notice about the use of html arguments in Nunjucks macros for production Jun 13, 2018
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from fcdd77b to 869e136 Compare June 14, 2018 09:20
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 09:20 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 09:21 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 09:25 Inactive
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from b97b028 to 37cbe54 Compare June 14, 2018 10:26
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 10:26 Inactive
@@ -1,3 +1,4 @@
{% set nunjucksHtmlUsageMessage = '**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting).**' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any components where this notice isn't being added? If not, is there any reason we couldn't just add this to this layout above the componentArguments block and save including this in every component?

Copy link
Author

Choose a reason for hiding this comment

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

no, it's everywhere. updated it. thanks

@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 37cbe54 to 431163c Compare June 14, 2018 13:19
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 13:19 Inactive
@@ -1,3 +1,4 @@
{% set nunjucksHtmlUsageMessage = '**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting).**' %}
Copy link
Contributor

@NickColley NickColley Jun 14, 2018

Choose a reason for hiding this comment

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

@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 431163c to 8fceec5 Compare June 14, 2018 13:53
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 13:53 Inactive
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 8fceec5 to 5a5b4d8 Compare June 14, 2018 14:50
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 14, 2018 14:51 Inactive
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 5a5b4d8 to 6f32d51 Compare June 15, 2018 10:14
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 15, 2018 10:15 Inactive
@kr8n3r kr8n3r force-pushed the add-html-in-nunjucks-arguments-messaging branch from 6f32d51 to 2be874d Compare June 15, 2018 14:09
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-785 June 15, 2018 14:10 Inactive
Jani Kraner added 3 commits June 18, 2018 16:34
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

As discussed with team, we want to test this approach and might revisit the solution in the next quarter.

For now, this addresses the points raised in the Trello card.

@kr8n3r kr8n3r merged commit bf508cb into master Jun 18, 2018
@kr8n3r kr8n3r deleted the add-html-in-nunjucks-arguments-messaging branch June 18, 2018 15:39
This was referenced Jun 21, 2018
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.

5 participants