diff options
| author | Xavier Morel <xmo@odoo.com> | 2015-11-25 09:40:34 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-11-30 16:39:13 +0100 |
| commit | 2afb5b43ef0c7aa69b63145052a8d183d3d9d14b (patch) | |
| tree | 106228e7191b04819576cf070b450d27d7bc2f61 /addons/website_form/controllers/main.py | |
| parent | 2769029eefd9456259c664ea846156fc9bd26a91 (diff) | |
[IMP] form builder fields blacklisting
* blacklist all fields by default
* don't use blacklist in get_authorized_fields which is called to see if
a field can be added to a form, instead only use it afterwards to see
if the field can be written to by the formbuilder. That way
formbuilder can whitelist fields which are actually added to forms
on-demand resulting in a more secure interaction
Diffstat (limited to 'addons/website_form/controllers/main.py')
| -rw-r--r-- | addons/website_form/controllers/main.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index f7f5f0d07ef..8aaa673f6ae 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -21,7 +21,6 @@ class WebsiteForm(http.Controller): try: data = self.extract_data(model_record, ** kwargs) - # If we encounter an issue while extracting data except ValidationError, e: # I couldn't find a cleaner way to pass data to an exception @@ -96,7 +95,7 @@ class WebsiteForm(http.Controller): 'custom': '', # Custom fields values } - authorized_fields = model.sudo().get_authorized_fields(); + authorized_fields = model.sudo()._get_form_writable_fields() error_fields = [] for field_name, field_value in kwargs.items(): @@ -183,7 +182,7 @@ class WebsiteForm(http.Controller): def insert_attachment(self, model, id_record, files): orphan_attachment_ids = [] record = model.env[model.model].browse(id_record) - authorized_fields = model.sudo().get_authorized_fields() + authorized_fields = model.sudo()._get_form_writable_fields() for file in files: custom_field = file.field_name not in authorized_fields attachment_value = { |
