• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE policymap [
3  <!ELEMENT policymap (policy)+>
4  <!ATTLIST policymap xmlns CDATA #FIXED ''>
5  <!ELEMENT policy EMPTY>
6  <!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
7    name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
8    stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
9]>
10<!--
11  Configure ImageMagick policies.
12
13  Domains include system, delegate, coder, filter, path, or resource.
14
15  Rights include none, read, write, execute and all.  Use | to combine them,
16  for example: "read | write" to permit read from, or write to, a path.
17
18  Use a glob expression as a pattern.
19
20  Suppose we do not want users to process MPEG video images:
21
22    <policy domain="delegate" rights="none" pattern="mpeg:decode" />
23
24  Here we do not want users reading images from HTTP:
25
26    <policy domain="coder" rights="none" pattern="HTTP" />
27
28  Lets prevent users from executing any image filters:
29
30    <policy domain="filter" rights="none" pattern="*" />
31
32  The /repository file system is restricted to read only.  We use a glob
33  expression to match all paths that start with /repository:
34
35    <policy domain="path" rights="read" pattern="/repository/*" />
36
37  Lets prevent users from executing any image filters:
38
39    <policy domain="filter" rights="none" pattern="*" />
40
41  Any large image is cached to disk rather than memory:
42
43    <policy domain="resource" name="area" value="1GP"/>
44
45  Define arguments for the memory, map, area, width, height and disk resources
46  with SI prefixes (.e.g 100MB).  In addition, resource policies are maximums
47  for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
48  exceeds policy maximum so memory limit is 1GB).
49
50  Rules are processed in order.  Here we want to restrict ImageMagick to only
51  read or write a small subset of proven web-safe image types:
52
53    <policy domain="delegate" rights="none" pattern="*" />
54    <policy domain="filter" rights="none" pattern="*" />
55    <policy domain="coder" rights="none" pattern="*" />
56    <policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
57-->
58<policymap>
59  <!-- <policy domain="system" name="shred" value="2"/> -->
60  <!-- <policy domain="system" name="precision" value="6"/> -->
61  <!-- <policy domain="system" name="memory-map" value="anonymous"/> -->
62  <!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
63  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
64  <!-- <policy domain="resource" name="memory" value="2GiB"/> -->
65  <!-- <policy domain="resource" name="map" value="4GiB"/> -->
66  <!-- <policy domain="resource" name="width" value="10KP"/> -->
67  <!-- <policy domain="resource" name="height" value="10KP"/> -->
68  <!-- <policy domain="resource" name="area" value="100MP"/> -->
69  <!-- <policy domain="resource" name="disk" value="16EiB"/> -->
70  <!-- <policy domain="resource" name="file" value="768"/> -->
71  <!-- <policy domain="resource" name="thread" value="4"/> -->
72  <!-- <policy domain="resource" name="throttle" value="0"/> -->
73  <!-- <policy domain="resource" name="time" value="3600"/> -->
74  <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
75  <!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
76  <!-- <policy domain="path" rights="none" pattern="@*" /> -->
77  <!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
78  <!-- <policy domain="cache" name="synchronize" value="True"/> -->
79  <!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
80</policymap>
81