From baba943e623ba5d1f12f579e87d04c6cb65fb061 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Thu, 16 Feb 2017 23:11:30 +0100 Subject: [PATCH] Fix xss (#173) Fix #173 Rewrite multi select widget as a template in order to have all values properly escaped. --- budget/forms.py | 2 +- budget/templates/forms.html | 13 ++++++++++++- budget/templates/list_bills.html | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/budget/forms.py b/budget/forms.py index adf3de76..ac181ece 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -118,7 +118,7 @@ class BillForm(Form): payer = SelectField(_("Payer"), validators=[Required()], coerce=int) amount = CommaDecimalField(_("Amount paid"), validators=[Required()]) payed_for = SelectMultipleField(_("For whom?"), - validators=[Required()], widget=select_multi_checkbox, coerce=int) + validators=[Required()], coerce=int) submit = SubmitField(_("Submit")) submit2 = SubmitField(_("Submit and add a new one")) diff --git a/budget/templates/forms.html b/budget/templates/forms.html index af24fe23..8698e372 100644 --- a/budget/templates/forms.html +++ b/budget/templates/forms.html @@ -85,7 +85,18 @@ {{ input(form.what, inline=True) }} {{ input(form.payer, inline=True, class="form-control custom-select") }} {{ input(form.amount, inline=True) }} - {{ input(form.payed_for, inline=True, class="form-check-input") }} + +
+ +
+ +
+
{{ form.submit(class="btn btn-primary") }} diff --git a/budget/templates/list_bills.html b/budget/templates/list_bills.html index 9421650e..a9af4def 100644 --- a/budget/templates/list_bills.html +++ b/budget/templates/list_bills.html @@ -107,7 +107,7 @@ {{ _("When?") }}{{ _("Who paid?") }}{{ _("For what?") }}{{ _("For whom?") }}{{ _("How much?") }}{{ _("Actions") }} {% for bill in bills %} - + {{ bill.date }} {{ bill.payer }} {{ bill.what }}