Permission issues with imagemagick converting pdf into image?

#1

Were any changes done to imagemagick or just the convert command permissions?
Seems now I am not able to convert anything in any of my projects
convert: not authorized test.pdf' @ error/constitute.c/ReadImage/412. convert: no images definedtest.jpg’ @ error/convert.c/ConvertImageCommand/3210.

Only thing I could find on it was


Where it says to open /etc/ImageMagick-6/policy.xml and change the rights for the pdf line to

<policy domain="coder" rights="read" pattern="PDF" />

The project name where I do this mainly is thatrockyboi its a discord bot with a backend for converting pdf into images that the bot uses, but the issue shouldn’t connected with it being part of a discord bot
Bot is in private mode but if staff needs me to unprivate it to look into it, I will gladly do so.
Sorry if I don’t answer any possible questions tonight, its getting pretty late.
Edit: I should add that the way I was testing if it was working is with convert test.pdf test.jpg or python server.js

#2

Hey @man-of-stone50 sorry for the bother. I don’t believe we’ve updated ImageMagick recently, and the system policy seems to have been last edited in Sept 2018. Was this something that once worked for you? If so, when was that?

1 Like
#4

It has been working for a couple months until at least last week, I believe I haven’t really made any changes since then.
It does the conversion every monday

#5

Hey @man-of-stone50 I’ve been digging into this, and have been able to adjust the security policy to one that everything seems ought to work but doesn’t. I’m still digging to see what I can uncover, but so far I’ve had no luck.

#7

Sorry for not replying to this sooner, I appreciate you taking your time to look into this issue, seems I have read permissions to “open” /etc/ImageMagick-6/policy.xml and it seems that the pdf line says <policy domain="coder" rights="none" pattern="PDF" /> and from what I could gather maybe its the rights part where it says none that might be the issue, I do also see that what you said is true that it was last modified in 2018 could the file have been replaced but the modifed date not changed?

#8

Actually I take it back, it might not be a good idea to edit that file since most of those are supposedly protections against code execution https://launchpad.net/ubuntu/+source/imagemagick/8:6.7.7.10-6ubuntu3.13.
Anyhow I saw someone else says that the policy file hadn’t been edited for them either but it did an update in the background and that broke it for him
https://files.catbox.moe/oyhmzd.png

#9

Sorry for triple replying but after doing some testing on a new install outside glitch the bug still happens and I could only fix it by changing the policy.