Skip to content

Instantly share code, notes, and snippets.

@yanowitz
Last active March 21, 2019 09:06
Show Gist options
  • Save yanowitz/8329d8b27d8294ca7027f504326fd629 to your computer and use it in GitHub Desktop.
Save yanowitz/8329d8b27d8294ca7027f504326fd629 to your computer and use it in GitHub Desktop.
fixing https://imagetragick.com/ (CVE-2016–3714) on heroku
1. Create a directory/file in your deploy repo's root dir (e.g., .ImageMagic/policy.xml), commit it.
2. Set the following config var:
heroku config:set MAGICK_CONFIGURE_PATH=/app/.ImageMagick -a YOUR-APP-NAME
3. Deploy
4. heroku run bash -a YOUR-APP-NAME
5. run
convert -list policy
Path: [built-in]
Policy: Undefined
rights: None
Path: /app/.ImageMagick/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
<policymap>
<policy domain="coder" rights="none" pattern="EPHEMERAL" />
<policy domain="coder" rights="none" pattern="HTTPS" />
<policy domain="coder" rights="none" pattern="MVG" />
<policy domain="coder" rights="none" pattern="MSL" />
</policymap>
@Thejaswiniy
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment