diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index 305c3ec7a3..810a7226aa 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Restrict protocols allowed for weasyprint to http(s) (issue14947) Version 8.0.7 - 2026-07-15 -------------------------- diff --git a/trytond/pyproject.toml b/trytond/pyproject.toml index 49aa365697..a324595753 100644 --- a/trytond/pyproject.toml +++ b/trytond/pyproject.toml @@ -60,7 +60,7 @@ test = [ 'pillow', 'pydot', ] -weasyprint = ['weasyprint'] +weasyprint = ['weasyprint >= 68.0'] [project.scripts] trytond = 'trytond.cli:main' diff --git a/trytond/trytond/report/report.py b/trytond/trytond/report/report.py index cf6519b3d3..62390b6ed4 100644 --- a/trytond/trytond/report/report.py +++ b/trytond/trytond/report/report.py @@ -414,7 +414,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'