Issue cropping images on heroku with image magick
-
- Posts: 8
- Joined: 2016-05-28T10:44:03-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
Hi,
ImageMagick was working perfectly for me on Heroku up until last month when the following security vulnerability was discovered:
https://imagetragick.com/
In response to it Heroku published the following post:
https://devcenter.heroku.com/changelog-items/891
My Guess is that they added the restrictions I mentioned before in their policy.xml file.
I'm just wondering if there's any other way from what I did to override their HTTPS policy as in my app the discovered vulnerability is irrelevant.
ImageMagick was working perfectly for me on Heroku up until last month when the following security vulnerability was discovered:
https://imagetragick.com/
In response to it Heroku published the following post:
https://devcenter.heroku.com/changelog-items/891
My Guess is that they added the restrictions I mentioned before in their policy.xml file.
I'm just wondering if there's any other way from what I did to override their HTTPS policy as in my app the discovered vulnerability is irrelevant.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
If they added the new policy.xml features, then you can edit them to remove the relevant ones you need to make your commands work.
See http://www.imagemagick.org/source/policy.xml
See http://www.imagemagick.org/source/policy.xml
-
- Posts: 8
- Joined: 2016-05-28T10:44:03-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
Yes, that's exactly what I tried to do: I added a new policy.xml file that suppose to override Heroku's policy.xml but for some reason it's not really doing it.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
Post your policy.xml file so we can see what you have. Check it with
Be sure you are putting it in the correct place. See http://legacy.imagemagick.org/script/resources.php
Code: Select all
convert -list policy
-
- Posts: 8
- Joined: 2016-05-28T10:44:03-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
alonfixler wrote:Hi volx757,
Did it work for you? I'm having the same problem and I tried to do what's suggested here https://gist.github.com/yanowitz/8329d8 ... 04326fd629 but instead of adding the policy configurations mentioned there I added what was suggested here: <policy domain="coder" rights="read | write" pattern="HTTPS" />
running convert -list policy from bash gave the following:
Path: [built-in]
Policy: Undefined
rights: None
Path: ImageMagick/policy.xml
Policy: Coder
rights: Read Write Execute
pattern: HTTPS
Policy: Coder
rights: Read Write Execute
pattern: URL
Path: /etc/ImageMagick/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: URL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Policy: Coder
rights: None
pattern: TEXT
Policy: Coder
rights: None
pattern: SHOW
Policy: Coder
rights: None
pattern: WIN
Policy: Coder
rights: None
pattern: PLT
Using imagemagick still fails and I wonder if adding another policy.xml file is the right approach. If it's working for you can you please describe what you did.
Thanks!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
What is your IM version? If too old, it does not recognize any policy.xml file.
-
- Posts: 8
- Joined: 2016-05-28T10:44:03-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
alonfixler wrote:Hi fmw42,
1. The path to the file I've added can be viewed in my bash output (ImageMagick/policy.xml)
2. I did the suggested restart
3. My exact command is: "convert -resize https://[my file path] 500x300 jpg:-
4. I'm usuing Heroku Cedar-14 stack and my imageMagick version is: 6.7.7-10
Because it stopped working for me after Heroku added a policy.xml disabling HTTPS, I'm assuming the used IM version supports policy.xml files.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
I do not think 6.7.7.10 works with policy.xml. It does not list the policy when i do
So perhaps they changed it in some other way.
Code: Select all
im67710 convert -policy
-
- Posts: 2
- Joined: 2016-06-16T00:01:15-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
Has anyone resolved this yet? I'm also having the same issue within the last month
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Issue cropping images on heroku with image magick
You'll have to say what the issue is, and what version you are using.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
That is malformed command. You need to read the input image before -resize. And you have the resize argument separate form -resize by the input.convert -resize https://[my file path] 500x300 jpg:-
try
Code: Select all
convert https://[my file path] -resize 500x300 jpg:-
-
- Posts: 2
- Joined: 2016-06-16T00:01:15-07:00
- Authentication code: 1151
Re: Issue cropping images on heroku with image magick
I can't seem to convert images in heroku anymore using https:// urls. Here's my version, policy, and the convert method. Do you have any suggestions?
Code: Select all
~ $ convert -version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Code: Select all
~ $ convert -list policy
Path: [built-in]
Policy: Undefined
rights: None
Path: /app/vendor/imagemagick/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: Read Write
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Path: /etc/ImageMagick/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: URL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Policy: Coder
rights: None
pattern: TEXT
Policy: Coder
rights: None
pattern: SHOW
Policy: Coder
rights: None
pattern: WIN
Policy: Coder
rights: None
pattern: PLT
Code: Select all
~ $ convert https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png -resize 300x300 jpg:-
convert.im6: not authorized `//play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' @ error/constitute.c/ReadImage/454.
convert.im6: no images defined `jpg:-' @ error/convert.c/ConvertImageCommand/3044.
~ $
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Issue cropping images on heroku with image magick
You have multiple policies. The one at /etc/ImageMagick/policy.xml, which has no HTTP privileges, probably takes precedent over the other one. The one at /app/vendor/imagemagick/policy.xml may not be a valid location. Or perhaps you have two versions of IM. See http://legacy.imagemagick.org/script/resources.php for valid policy locations.