Skip to content

Drop support for Python 3.8 due to MD5 usedforsecurity issue? #406

@deeplook

Description

@deeplook

While testing #405 on Python 3.8 I've stumbled over this issue which appears to be due to the reportlab>=4.4.3 dependency likely causing the TypeError: 'usedforsecurity' is an invalid keyword argument for openssl_md5(). This suggests an incompatibility between reportlab and Python 3.8, as the usedforsecurity argument didn't exist there and was introduced in Python 3.9.

There are implications with FIPS as mentioned here, and the error disappears when running under Python 3.9, so I wouldn't mind simply dropping support for Python 3.8, but it would be interesting to hear more from ReportLab, @replabrobin?

uv run pytest tests/test_samples.py
...
------------------------------------------------ Captured stdout call ------------------------------------------------
working on [0] /Users/dinugherman/dev/svglib/tests/samples/W3C_SVG_12_TinyTestSuite/svg/animate-elem-217-t.svg
___________________________________________ TestOtherFiles.test_png_in_svg ___________________________________________

self = <tests.test_samples.TestOtherFiles object at 0x1071c3d00>

    def test_png_in_svg(self):
        path = join(TEST_ROOT, "samples", "others", "png_in_svg.svg")
        drawing = svglib.svg2rlg(path)
>       result = renderPDF.drawToString(drawing)

tests/test_samples.py:419: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.8/site-packages/reportlab/graphics/renderPDF.py:331: in drawToString
    drawToFile(d, s, msg=msg, showBoundary=showBoundary,autoSize=autoSize, **kwds)
.venv/lib/python3.8/site-packages/reportlab/graphics/renderPDF.py:298: in drawToFile
    c = Canvas(fn,**kwds)
.venv/lib/python3.8/site-packages/reportlab/pdfgen/canvas.py:320: in __init__
    self._doc = pdfdoc.PDFDocument(compression=pageCompression,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <reportlab.pdfbase.pdfdoc.PDFDocument object at 0x109795190>, dummyoutline = 0, compression = None
invariant = 0, filename = <_io.BytesIO object at 0x109953090>, pdfVersion = (1, 3), lang = None

    def __init__(self,
                 dummyoutline=0,
                 compression=rl_config.pageCompression,
                 invariant=rl_config.invariant,
                 filename=None,
                 pdfVersion=PDF_VERSION_DEFAULT,
                 lang=None,
                 ):
        self._ID = None
        self.objectcounter = 0
        self.shadingCounter = 0
        self.inObject = None
        self.pageCounter = 1
    
        # allow None value to be passed in to mean 'give system defaults'
        if invariant is None:
            self.invariant = rl_config.invariant
        else:
            self.invariant = invariant
        self.setCompression(compression)
        self._pdfVersion = pdfVersion
        # signature for creating PDF ID
>       sig = self.signature = md5(usedforsecurity=False)
E       TypeError: 'usedforsecurity' is an invalid keyword argument for openssl_md5()

.venv/lib/python3.8/site-packages/reportlab/pdfbase/pdfdoc.py:137: TypeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions