mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-30 00:48:32 -04:00
fix xss with service letter contact blocks
service contact blocks contain new lines - and jinja2 normally ignores
newlines (as in it keeps them as new lines) - but we need to turn them
into `<br>` tags so that we can show the formatting that the user has
added. We were previously just doing `{{ block | nl2br | safe }}`. nl2br
turns the new lines into `<br>` tags, and then `safe` tells jinja that
it doesn't need to escape the html.
this causes issues if the user adds `<script>alert(1)</script>` to their
contact block (or some other evil xss hack), where that will get let
through due to the safe flag
To solve this, use `Markup(html='escape')` to sanitise any html, and
then convert new lines to <br>.
bump utils
another xss
This commit is contained in:
@@ -136,7 +136,7 @@
|
||||
{% call settings_row(if_has_permission='sms') %}
|
||||
{{ text_field('Text message senders') }}
|
||||
{% call field(status='default' if current_service.default_sms_sender == "None" else '') %}
|
||||
{{ current_service.default_sms_sender | string | nl2br | safe if current_service.default_sms_sender else 'None'}}
|
||||
{{ current_service.default_sms_sender | string | nl2br if current_service.default_sms_sender else 'None'}}
|
||||
{% if current_service.count_sms_senders > 1 %}
|
||||
<div class="hint">
|
||||
{{ '…and %d more' | format(current_service.count_sms_senders - 1) }}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{% for item in letter_contact_details %}
|
||||
<div class="user-list-item">
|
||||
<p>
|
||||
{{ item.contact_block | nl2br | safe }}
|
||||
{{ item.contact_block | nl2br }}
|
||||
</p>
|
||||
<p class="hint">
|
||||
{%- if item.is_default -%}
|
||||
|
||||
Reference in New Issue
Block a user