Skip to content

Restrict image formats when opening templates and imported profile images #157

Closed

Description

@TMHSDigital

Summary

Image.open is called without formats=, so embedded images in an imported profile are probed by every Pillow decoder plugin before the PNG check runs.

Where

  • autoclicker/core/image_match.py:47 (open_template)
  • autoclicker/core/image_match.py:77 (store_embedded_image)
  • autoclicker/gui/features/image.py:117 (preview)

Details

store_embedded_image decodes base64 from an imported profile and checks probe.format != "PNG" only after Pillow has already tried all registered formats on the bytes.

Impact

Profiles are meant to be shareable, so limiting decoders to the formats the app actually writes narrows exposure to future Pillow decoder bugs. Not exploitable with the current Pillow.

Suggested fix

Pass formats=["PNG"] at line 77 and the formats the UI accepts (for example ["PNG", "BMP", "JPEG"]) at lines 47 and 117.

Acceptance criteria

  • All three Image.open calls pass an explicit formats list
  • Test: a non-PNG embedded image is rejected

Getting started

  • Relevant files: autoclicker/core/image_match.py, autoclicker/gui/features/image.py, tests/test_image_target.py
  • How to run tests: make check (Git Bash) or tasks.bat lint, tasks.bat typecheck, tasks.bat test (cmd). Single test: python -m pytest tests/test_x.py::TestClass::test_name --no-cov
  • Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 9968dc8. Severity: low. Effort: S. audit-key: quality|autoclicker/core/image_match.py|store_embedded_image

Activity

  1. added
    good first issue
    priority: low
    maintenance
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuemaintenancepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions