Restrict protocols allowed for weasyprint to http(s)

Closes #14947
This commit is contained in:
Cédric Krier
2026-07-24 10:49:42 +02:00
parent 4bd7cfa657
commit 8414cd718f
3 changed files with 8 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Restrict protocols allowed for weasyprint to http(s) (issue14947)
* Add search attribute to XML record tag
* Enforce access right on the email template record (issue14907)
* Add ModelAccessProxy (issue14907)
+1 -1
View File
@@ -58,7 +58,7 @@ test = [
'pillow',
'pydot',
]
weasyprint = ['weasyprint']
weasyprint = ['weasyprint >= 68.0']
[project.scripts]
trytond = 'trytond.cli:main'
+6 -1
View File
@@ -413,7 +413,12 @@ class Report(URLMixin, PoolBase):
if (input_format in {'html', 'xhtml'}
and output_format == 'pdf'):
if weasyprint := _lazy_import('weasyprint'):
return output_format, weasyprint.HTML(string=data).write_pdf()
return output_format, weasyprint.HTML(
string=data,
url_fetcher=weasyprint.URLFetcher(
allowed_protocols={'http', 'https'},
),
).write_pdf()
if (input_format == 'xml'
and output_format == 'html'