diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/imagemagick/policy.xml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/config/imagemagick/policy.xml b/config/imagemagick/policy.xml new file mode 100644 index 00000000..6106aa0b --- /dev/null +++ b/config/imagemagick/policy.xml | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!-- | ||
| 3 | Read because FileAttachment sets MAGICK_CONFIGURE_PATH to this directory | ||
| 4 | on every magick invocation. ImageMagick prepends that path to its search | ||
| 5 | list rather than replacing it, so /usr/local/etc/ImageMagick-7/policy.xml | ||
| 6 | is still read afterwards and any hardening the port gains still applies. | ||
| 7 | Rules are processed in order, so these win. | ||
| 8 | |||
| 9 | Coders kept readable and why: | ||
| 10 | PDF, PS the rasterised branch and the 150dpi social card | ||
| 11 | SVG, MSVG the vector social card | ||
| 12 | JPEG PNG GIF WEBP the four accepted image types | ||
| 13 | LABEL used by internal operations | ||
| 14 | --> | ||
| 15 | <policymap> | ||
| 16 | <!-- Variants are generated synchronously on upload, so an oversized or | ||
| 17 | slow source blocks a request thread. A decompression bomb needs no | ||
| 18 | vulnerability at all. --> | ||
| 19 | <policy domain="resource" name="memory" value="256MiB"/> | ||
| 20 | <policy domain="resource" name="map" value="512MiB"/> | ||
| 21 | <policy domain="resource" name="area" value="128MP"/> | ||
| 22 | <policy domain="resource" name="disk" value="1GiB"/> | ||
| 23 | <policy domain="resource" name="width" value="16KP"/> | ||
| 24 | <policy domain="resource" name="height" value="16KP"/> | ||
| 25 | <policy domain="resource" name="list-length" value="64"/> | ||
| 26 | <policy domain="resource" name="time" value="120"/> | ||
| 27 | |||
| 28 | <!-- @file means "read this path as the argument", and - is stdin. --> | ||
| 29 | <policy domain="path" rights="none" pattern="@*"/> | ||
| 30 | <policy domain="path" rights="none" pattern="-"/> | ||
| 31 | |||
| 32 | <!-- ImageMagick picks its decoder from the file's bytes, not from the | ||
| 33 | declared content type, so an upload announced as image/jpeg is | ||
| 34 | decoded as MVG if that is what it contains. These are the coders | ||
| 35 | that turn that into a file read or a fetch. --> | ||
| 36 | <policy domain="coder" rights="none" pattern="MVG"/> | ||
| 37 | <policy domain="coder" rights="none" pattern="MSL"/> | ||
| 38 | <policy domain="coder" rights="none" pattern="URL"/> | ||
| 39 | <policy domain="coder" rights="none" pattern="HTTP"/> | ||
| 40 | <policy domain="coder" rights="none" pattern="HTTPS"/> | ||
| 41 | <policy domain="coder" rights="none" pattern="FTP"/> | ||
| 42 | <policy domain="coder" rights="none" pattern="EPHEMERAL"/> | ||
| 43 | <policy domain="coder" rights="none" pattern="SHOW"/> | ||
| 44 | <policy domain="coder" rights="none" pattern="WIN"/> | ||
| 45 | <policy domain="coder" rights="none" pattern="PLT"/> | ||
| 46 | <policy domain="coder" rights="none" pattern="XPS"/> | ||
| 47 | <policy domain="coder" rights="none" pattern="TEXT"/> | ||
| 48 | </policymap> | ||
