Skip to content

Commit 13433dc

Browse files
aclark4lifeCopilot
andcommitted
Update docs/handbook/security.rst
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 74e07b5 commit 13433dc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

docs/handbook/security.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ type. An attacker can name a file ``safe.png`` while its content is TIFF, JPEG
4646
2000, or EPS, causing a different — potentially more dangerous — parser to run.
4747

4848
*Mitigations:* validate MIME type and magic bytes independently before calling
49-
``Image.open()``; pass the ``format`` parameter explicitly; maintain an
50-
allowlist of accepted formats.
49+
``Image.open()``; pass the ``formats`` argument with an allowlist of accepted
50+
formats.
5151

5252
**S-2 — Plugin registry spoofing**
5353

@@ -226,8 +226,9 @@ The following mitigations are listed in priority order.
226226
advisories <https://github.com/python-pillow/Pillow/security/advisories>`_.
227227
5. **Enforce** ``MAX_IMAGE_PIXELS`` — never set it to ``None``; treat
228228
``Image.DecompressionBombWarning`` as an error.
229-
6. **Allowlist image formats** — unregister plugins your application does not
230-
need.
229+
6. **Allowlist image formats** — restrict accepted formats when opening
230+
images, for example with ``Image.open(..., formats=...)``, and isolate
231+
installs/environments if you need to minimise supported formats.
231232
7. **Strip metadata on output** — never pass through EXIF/XMP/ICC from user
232233
uploads to publicly served images.
233234
8. **Sanitise all metadata** returned by Pillow before using it downstream.

0 commit comments

Comments
 (0)