Skip to content

Commit

Permalink
Pleasing bandit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Mar 10, 2023
1 parent efb668a commit 30f4c25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .banditrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ skips:
# Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# => OK, we don't care though
- B101
# Use of insecure MD5 hash function
# => OK, we always use md5 with usedforsecurity=False
# => cf. https://github.com/PyCQA/bandit/issues/994
- B324
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
- hyperlinks were not working on encrypted files - thanks to @andersonhc
- unicode (non limited to ASCII) text can now be provided as metadata [#685](https://github.com/PyFPDF/fpdf2/issues/685)
- all `TitleStyle` constructor parameters are now effectively optional
- memory usage was reduced by 10 MiB in some cases, thanks to a small optimization in using `fonttools`
### Changed
- vector images parsing is now more robust: `fpdf2` can now embed SVG files without `viewPort` or no `height` / `width`
- bitonal images are now encoded using `CCITTFaxDecode`, reducing their size in the PDF document - thanks to @eroux
Expand Down
3 changes: 2 additions & 1 deletion fpdf/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ def from_file(cls, filename, *args, encoding="utf-8", **kwargs):
def __init__(self, svg_text):
self.cross_references = {}

svg_tree = parse_xml_str(svg_text)
# disabling bandit rule as we use defusedxml:
svg_tree = parse_xml_str(svg_text) # nosec B314

if svg_tree.tag not in xmlns_lookup("svg", "svg"):
raise ValueError(f"root tag must be svg, not {svg_tree.tag}")
Expand Down

0 comments on commit 30f4c25

Please sign in to comment.