Error reading SVG file due to rights

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
uigrad
Posts: 6
Joined: 2014-10-28T09:43:41-07:00
Authentication code: 6789

Error reading SVG file due to rights

Post by uigrad »

I have a server script that uses Imagemagick for processing SVG images, and I use MSVG for interpreting it. Until recently this has always worked:

Code: Select all

convert +antialias -density 100x100 MSVG:orig.svg output.png
Now, I get:

Code: Select all

stitching: not authorized `/tmp/magick-82738sMRaAneTAQdM' @ error/constitute.c/ReadImage/412.
stitching: no images defined `output.png' @ error/convert.c/ConvertImageCommand/3257.
A bit of searching tells me it is due to security policy stuff. If I type "convert -list policy", I get:

Code: Select all

Path: /usr/local/etc/ImageMagick-6/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

Path: [built-in]
  Policy: Undefined
    rights: None 
That .xml file is not something that I can modify without administrator privileges (which I do not have), and I see nothing in the policy about SVG or MSVG. What do I need to do to get this to work again?
Last edited by uigrad on 2018-01-10T12:05:03-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Error reading SVG file due to rights

Post by magick »

Your instance of ImageMagick likely utilizes the internal SVG render which converts SVG to MVG to render it-- and the policy prevents that. Your choices are to get the administrator to install inkscape so ImageMagick uses that for rendering SVG, modify the policy to permit MVG, or install ImageMagick in your user account where you can define your own security policy.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error reading SVG file due to rights

Post by fmw42 »

You could also have your administrator install RSVG and recompile ImageMagick. But Inkscape is often better than RSVG and both are better than MVG. I do not believe that a recompile is needed for Inkscape. ImageMagick will use it if it finds it on your system.
uigrad
Posts: 6
Joined: 2014-10-28T09:43:41-07:00
Authentication code: 6789

Re: Error reading SVG file due to rights

Post by uigrad »

Unfortunately, I must use MSVG, because there is no way to turn off anti-aliasing for batch renders with Inkscape. I had a previous post about it here:

viewtopic.php?f=1&t=26449&p=116373

Is there any way that I can override the policy by adding another command line argument?

I just tried using Inkscape again. I gave the +antialias argument, and it went from having 5 colors to 990. That is unacceptable. :/
uigrad
Posts: 6
Joined: 2014-10-28T09:43:41-07:00
Authentication code: 6789

Re: Error reading SVG file due to rights

Post by uigrad »

I found this thread that suggests that policy files can be placed in other locations. Using the method there, I discovered that /home/private/.magick/ is a place that it searched for policy files. So, I copied policy.xml there, changed "none" to "read" for MVG, and now when I query convert -list policy, I get both locations, but the system default location is first:

Code: Select all

% convert -list policy

Path: /usr/local/etc/ImageMagick-6/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

Path: /home/private//.magick/policy.xml
  Policy: Coder
    rights: None 
    pattern: EPHEMERAL
  Policy: Coder
    rights: None 
    pattern: URL
  Policy: Coder
    rights: None 
    pattern: HTTPS
  Policy: Coder
    rights: Read 
    pattern: MVG
  Policy: Coder
    rights: None 
    pattern: MSL

Path: [built-in]
  Policy: Undefined
    rights: None 
I tried my SVG to PNG operation again, and it still failed. Does this mean I can't override the system default?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error reading SVG file due to rights

Post by snibgo »

uigrad wrote:Does this mean I can't override the system default?
Correct. Personal policy files can only add rules. Users can tighten security, but can't loosen it. If they (we) could, it wouldn't be security.
snibgo's IM pages: im.snibgo.com
uigrad
Posts: 6
Joined: 2014-10-28T09:43:41-07:00
Authentication code: 6789

Re: Error reading SVG file due to rights

Post by uigrad »

magick wrote: 2017-11-09T12:48:41-07:00 or install ImageMagick in your user account where you can define your own security policy.

I've tried doing this. The system is BSD, but ./configure --prefix=home/private/bin seemed to work just fine.

make ran a really long time. It generated the same warning from timeb.h over and over. Finally, it failed in _la-wand-view.lo, I think:

Code: Select all


/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated" [-Wcpp]
 #warning "this file includes <sys/timeb.h> which is deprecated"
  ^
  CCLD     MagickWand/libMagickWand-7.Q16HDRI.la
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Blob.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-BlobRef.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-CoderInfo.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Color.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Drawable.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Exception.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Functions.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Geometry.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Image.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-ImageRef.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Montage.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Options.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Pixels.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-ResourceLimits.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Statistic.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-STL.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Thread.lo
  CXX      Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-TypeMetric.lo
  CXXLD    Magick++/lib/libMagick++-7.Q16HDRI.la
  CC       utilities/magick.o
In file included from ./MagickWand/studio.h:173:0,
                 from utilities/magick.c:44:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated" [-Wcpp]
 #warning "this file includes <sys/timeb.h> which is deprecated"
  ^
  CCLD     utilities/magick
make[1]: don't know how to make MagickCore/ImageMagick-7.Q16HDRI.pc. Stop

make[1]: stopped in /home/private/install/ImageMagick-7.0.7-10
*** Error code 2

Stop.
make: stopped in /home/private/install/ImageMagick-7.0.7-10
Post Reply