Browse Source

DIV-1101 - Marked false positives for Bandit checks

pull/172/head
Gerrit van der Merwe 5 years ago
parent
commit
656555f74d
3 changed files with 6 additions and 5 deletions
  1. +1
    -1
      edivorce/apps/core/management/commands/link_check.py
  2. +3
    -2
      edivorce/apps/core/templatetags/format_utils.py
  3. +2
    -2
      edivorce/apps/core/templatetags/summary_format.py

+ 1
- 1
edivorce/apps/core/management/commands/link_check.py View File

@ -13,7 +13,7 @@ class Command(BaseCommand):
def _check_link(self, address):
try:
resp = urlopen(address)
resp = urlopen(address) # nosec - This is for internal use only to check for broken links.
if resp.status in [400, 404, 403, 408, 409, 501, 502, 503]:
return f"{resp.status} - {resp.reason}"
except Exception as e:


+ 3
- 2
edivorce/apps/core/templatetags/format_utils.py View File

@ -21,7 +21,7 @@ def linebreaksli(value):
value = re.sub(r'\r\n|\r|\n', '\n', value.strip()) # normalize newlines
lines = re.split('\n', value)
lines = ['<li>%s</li>' % line for line in lines if line and not line.isspace()]
return mark_safe('\n'.join(lines))
return mark_safe('\n'.join(lines)) # nosec
@register.filter
@ -92,7 +92,8 @@ def checkbox(context, *args, **kwargs):
kwargs_list.append(str(value) in str(dict_with_question[question]))
kwargs_pass = all(kwargs_list)
return mark_safe('<i class="fa fa%s-square-o" aria-hidden="true"></i>' %
return mark_safe('<i class="fa fa%s-square-o" aria-hidden="true"></i>' % # nosec
('-check' if args_pass and kwargs_pass else ''))


+ 2
- 2
edivorce/apps/core/templatetags/summary_format.py View File

@ -8,7 +8,7 @@ from django.utils.html import format_html, format_html_join
from django.utils.safestring import mark_safe
NO_ANSWER = 'No answer'
MISSING_RESPONSE = mark_safe('<div class="table-error"><span class="warning">MISSING REQUIRED FIELD</span></div>')
MISSING_RESPONSE = mark_safe('<div class="table-error"><span class="warning">MISSING REQUIRED FIELD</span></div>') # nosec
register = template.Library()
@ -151,7 +151,7 @@ def format_review_row_heading(title, style="", substep=None):
""" Used for children sub-section tables """
if substep:
url = reverse('question_steps', args=['children', substep])
extra_html = mark_safe(f'<span class="review-buttons"><a href="{url}">Edit</a></span>')
extra_html = mark_safe(f'<span class="review-buttons"><a href="{url}">Edit</a></span>') # nosec
else:
extra_html = ''
return format_html(


Loading…
Cancel
Save