I am a programmer and as part of a website I need to be able to take LaTeX source files and compile them, then return the pdf to the user. This seems dangerous since a malicious user could e.g. read and write files on server this way. Is it possible to 'clean' a LaTeX file so it's safe to compile or is it too complicated?
|
|
In
I think you may want to set this simply to
This allows anyone to read any files on your system (if the user has the necessary rights), so maybe you'll want to change this, too.
This may lead to the tex files being read with another macro package than intended - I don't know whether this is critical, but you should think about it.
These settings (or non-settings) decide whether needed files (like fonts/font metrics) are automatically generated when needed. I don't know whether this would be a security risk, but it certainly can prolong compilation. Later there are some memory limits to set, which also may be useful. You can change these settings globally in your texmf.cnf, or give them as environment variables to the programs invoked (environment takes precedence). Some options may also be given on the command line. |
|||||||||
|
|
in the configuration |
|||
|
|
|
You could filter for some specific macros, but there is most definitely a way to overcome this. TeX is a very complicated language to parse if you don't use TeX itself for it. You need to make sure that the You might want to use the For a Unix-like OS I would recommend to run it in a chroot environment with minimal system files present under a user which has only minimal read and write permissions. This plus disabled shell-escape should make it very safe. |
|||||||||||||||
|
