Skip to content

Provide a documented way to turn off EPS handling via Ghostscript #7391

@raphaelm

Description

@raphaelm

Pillow parses EPS files through ghostscript.

Ghostscript is troubled with regular security issues of critical impact, such as remote code execution. There has been this one, two CVEs this year already, and there is another one just coming up with the patch not yet included in any release.

We do not need EPS handling and we can turn it off in our code using Image.open(…, formats=["JPG", "PNG", …]). However, we use third-party components that also use Pillow (such as reportlab) and we'd like to make sure they also don't accidentally open EPS files and we can't modify the code.

From what I can tell, we can accomplish this with:

from PIL import Image

if "EPS" in Image.ID:
    Image.ID.remove("EPS")

However, that seems to be undocumented and feels like unclean monkeypatching. I think it would be worth it providing a documented API to turn off third-party backends like ghostscript globally.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions