jardiacaj/finem_imperii

Use format_html for HTML-generating functions

Closed this issue · 1 comments

Currently the regular str.format() function is used in HTML-generating functions. For example:

def get_html_link(self):

This forces to use the |safe tag in templates when outputting the result, which creates XSS vulnerabilities. For example:

{{ request.hero.location.tile.get_html_link|safe }}.

A better solution would be to use django.utils.html.format_html(): https://docs.djangoproject.com/en/1.11/ref/utils/#django.utils.html.format_html

This issue is now fixed. Thanks a lot for your help!