Commit bebcda56b for imagemagick.org
commit bebcda56b8a3d82322b0d690454b8db9c346476f
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sat Nov 7 15:35:16 2026 -0500
add an example coder policy
diff --git a/config/policy-limited.xml b/config/policy-limited.xml
index 2b3f03490..640fa49fe 100644
--- a/config/policy-limited.xml
+++ b/config/policy-limited.xml
@@ -118,12 +118,12 @@
<!--
Restrict high-risk coders.
- Read access is denied while write access remains permitted.
- This allows ImageMagick to generate these formats without accepting
- potentially untrusted input through them.
+ Certain modules are denied, whereas, read access is denied while write
+ access remains permitted for others. This allows ImageMagick to generate
+ these formats without accepting potentially untrusted input through them.
-->
- <policy domain="module" rights="write"
- pattern="{MSL,MVG,PDF,PS,SVG,TXT,URL,XPS}"/>
+ <policy domain="module" rights="none" pattern="{MSL,URL,VIDEO}"/>
+ <policy domain="coder" rights="write" pattern="{MVG,PDF,PS,SVG,TXT,XPS}"/>
<!-- Optional: overwrite temporary files and buffers before deletion. -->
<!-- <policy domain="system" name="shred" value="1"/> -->
diff --git a/config/policy-open.xml b/config/policy-open.xml
index 76b422558..44b4e2f05 100644
--- a/config/policy-open.xml
+++ b/config/policy-open.xml
@@ -174,20 +174,16 @@
<!-- Disable pipe execution. -->
<!-- <policy domain="path" rights="none" pattern="|*"/> -->
- <!-- ================================================================== -->
- <!-- Module Restrictions -->
- <!-- ================================================================== -->
-
<!--
- Disable reading of higher-risk formats while still permitting writes.
-
- Common candidates include:
- MSL, MVG, PDF, PS, SVG, TXT, URL, and XPS
+ Restrict high-risk coders.
- Review carefully before enabling.
+ Certain modules are denied, whereas, read access is denied while write
+ access remains permitted for others. This allows ImageMagick to generate
+ these formats without accepting potentially untrusted input through them.
-->
- <!-- <policy domain="module" rights="write"
- pattern="{MSL,MVG,PDF,PS,SVG,TXT,URL,XPS}"/> -->
+ <!-- <policy domain="module" rights="none" pattern="{MSL,URL,VIDEO}"/> -->
+ <!-- <policy domain="coder" rights="write"
+ pattern="{MVG,PDF,PS,SVG,TXT,XPS}"/> -->
<!-- ================================================================== -->
<!-- System Policies -->
diff --git a/config/policy-secure.xml b/config/policy-secure.xml
index 036ada73e..a97f94ac9 100644
--- a/config/policy-secure.xml
+++ b/config/policy-secure.xml
@@ -116,11 +116,14 @@
<policy domain="path" rights="none" pattern="|*"/>
<!--
- Permit writing, but not reading, of high-risk formats and pseudo-formats.
- Reads are blocked; writes remain available when needed.
+ Restrict high-risk coders.
+
+ Certain modules are denied, whereas, read access is denied while write
+ access remains permitted for others. This allows ImageMagick to generate
+ these formats without accepting potentially untrusted input through them.
-->
- <policy domain="module" rights="write"
- pattern="{MSL,MVG,PDF,PS,SVG,TXT,URL,XPS}"/>
+ <policy domain="module" rights="none" pattern="{MSL,URL,VIDEO}"/>
+ <policy domain="coder" rights="write" pattern="{MVG,PDF,PS,SVG,TXT,XPS}"/>
<!-- Number of overwrite passes before temporary data is deleted. -->
<policy domain="system" name="shred" value="1"/>
diff --git a/config/policy-websafe.xml b/config/policy-websafe.xml
index 1e2e3b319..cbedd825e 100644
--- a/config/policy-websafe.xml
+++ b/config/policy-websafe.xml
@@ -123,17 +123,14 @@
<!-- Disable all loadable image filters. -->
<policy domain="filter" rights="none" pattern="*"/>
- <!-- ============================================================= -->
- <!-- High-Risk Module Restrictions -->
- <!-- ============================================================= -->
-
- <!-- Disable the Magick Vector Graphics interpreter. -->
- <policy domain="module" rights="none" pattern="MVG"/>
-
- <!-- Disable the Magick Scripting Language interpreter. -->
- <policy domain="module" rights="none" pattern="MSL"/>
-
- <!-- Disable URL, HTTP, HTTPS, and related network access support. -->
- <policy domain="module" rights="none" pattern="URL"/>
+ <!--
+ Restrict high-risk coders.
+
+ Certain modules are denied, whereas, read access is denied while write
+ access remains permitted for others. This allows ImageMagick to generate
+ these formats without accepting potentially untrusted input through them.
+ -->
+ <policy domain="module" rights="none" pattern="{MSL,URL,VIDEO}"/>
+ <policy domain="coder" rights="write" pattern="{MVG,PDF,PS,SVG,TXT,XPS}"/>
</policymap>