latex icon indicating copy to clipboard operation
latex copied to clipboard

Switching the -no-shell-escape flag

Open bomb-on opened this issue 9 years ago • 4 comments

Is it possible to override -no-shell-escape flag somehow? I have an use case where I have to use this flag because of inline images and similar weirdness :)

If it's not possible, would you mind if I send an extremely simple pull request which would allow switching this flag?

bomb-on avatar Jun 24 '16 16:06 bomb-on

Just something simple like this maybe? #13

bomb-on avatar Jun 24 '16 17:06 bomb-on

Currently it's not allowed solely for "err on the side of security" reasons. It seemed conceivable, that someone would use this to build untrusted latex sources from users - not something I'd recommend, but I did not want to be the one responsible for threats emerging from that angle.

I realize that there may be a need for these kinds of things, but I will have to think about that. Can you elaborate a slight bit more why in your case it's not possible to work around these issues with "safe" latex?

mbr avatar Jun 25 '16 10:06 mbr

I completely understand security reasons behind it...

I am using LaTeX "templates" created in-house, so I trust them 100%. I have to update them with data from database and dynamically generated images embedded as base64 strings. I am no LaTeX user myself so after searching for a while how to do that, I came to the conclusion that this flag has to be set and I came across this SO question. In the very end of the answer this guy is describing exactly my workflow :) Looking at his gist I tried to play around with changing flags in your code and realised that my LaTeX with inline images cannot be compiled without changing to -shell-escape.

bomb-on avatar Jun 26 '16 18:06 bomb-on

I have the same issue when using the barcode module in LaTex. They are generated as pictures and then included. The pdflatex command has to be invoked with the -shell-escape option for this to work. In this case I have to use pdflatex, so it would be sufficient to make the args a class member in the __init__ of PdfLatexBuilder and use self.args to reference them in the build_pdf. Then I could subclass it and overwrite the args to my needs. Right now I subclass PdfLatexBuilder and have to overwrite the complete build_pdf method having all the required imports. Which is nearly the whole class.

ap91484 avatar Jan 15 '18 10:01 ap91484