docs: Makefile: Add -no-shell-escape option to LATEXOPTS
PATCH 1/1 docs: Makefile: Add -no-shell-escape option to LATEXOPTS
By adding this option, message of "restricted \write18 enabled" from LaTeX can be silenced.
As there is no use of \write18 in LaTeX sources from sphinx-build, it is safe to add this option.
--- Documentation/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/Makefile +1 -1
@@ -26,7 +26,7 @@ SPHINX_CONF = conf.py PAPER = BUILDDIR = $(obj)/output PDFLATEX = xelatex -LATEXOPTS = -interaction=batchmode +LATEXOPTS = -interaction=batchmode -no-shell-escape ifeq ($(KBUILD_VERBOSE),0) SPHINXOPTS += "-q"
base-commit: f647de4b02dcb1815fb3019f86a001a681daf0a1
Signature · 1 line
2.17.1
Quoted 5 lines · Akira Yokosawa
By adding this option, message of "restricted \write18 enabled" from LaTeX can be silenced.
As there is no use of \write18 in LaTeX sources from sphinx-build, it is safe to add this option.
Jon,
JFYI, there is a ticket on the message at:
I think David Carlisle's answer covers most of your concerns.
Thanks, Akira
Quoted 4 lines
Reported-by Jonathan Corbet <[email protected]>Signed-off-by Akira Yokosawa <[email protected]>---
[...]
Jonathan Corbet
maintainerQuoted 17 lines · Akira Yokosawa
By adding this option, message of "restricted \write18 enabled" from LaTeX can be silenced.
As there is no use of \write18 in LaTeX sources from sphinx-build, it is safe to add this option.
Reported-by Jonathan Corbet <[email protected]>Signed-off-by Akira Yokosawa <[email protected]>--- Documentation/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Documentation/Makefile +0
-0
Documentation/Makefile SPHINX_CONF = conf.py · line 29
Quoted 5 lines
Documentation/Makefile +1
-1@@ -26,7 +26,7 @@ SPHINX_CONF = conf.py PAPER = BUILDDIR = $(obj)/output PDFLATEX = xelatex -LATEXOPTS = -interaction=batchmode +LATEXOPTS = -interaction=batchmode -no-shell-escape
Interesting. In my digging now and back in 2016 [1] everything I found said that \write18 had to be explicitly enabled - and for good reason. And I could never figure out *how* we were enabling it... It turns out that the net misinformed me; how come nobody ever told me that could happen? :)
Anyway, I've applied this, but I'm going to tweak the changelog a bit. My reason for wanting this isn't to make the warning go away - it's a *tiny* piece of the noise of a pdfdocs build. That warning is there for a reason; \write18 is dangerous. We really don't want any way for arbitrary shell commands to be executed via the docs build. So the new text is:
It turns out that LaTeX enables \write18, which allows arbitrary shell commands to be executed from the document source, by default. This the often-seen warning during a pdfdocs build:
restricted \write18 enabled
That is a potential security problem and is entirely unnecessary; nothing in the kernel PDF docs build needs that capability. So disable \write18 explicitly.
I think I'll add a Cc: stable while I'm at it. I know of no actual threat, but this is best closed.
Thanks for fixing this,
jon
Quoted 1 line · Jonathan Corbet
Akira Yokosawa <[email protected]> writes:
[...]
Quoted 29 lines
Documentation/Makefile SPHINX_CONF = conf.py · line 29
Quoted 11 lines
Documentation/Makefile +1
-1@@ -26,7 +26,7 @@ SPHINX_CONF = conf.py PAPER = BUILDDIR = $(obj)/output PDFLATEX = xelatex -LATEXOPTS = -interaction=batchmode +LATEXOPTS = -interaction=batchmode -no-shell-escapeInteresting. In my digging now and back in 2016 [1] everything I found said that \write18 had to be explicitly enabled - and for good reason. And I could never figure out *how* we were enabling it... It turns out that the net misinformed me; how come nobody ever told me that could happen? :)
Anyway, I've applied this, but I'm going to tweak the changelog a bit. My reason for wanting this isn't to make the warning go away - it's a *tiny* piece of the noise of a pdfdocs build. That warning is there for a reason; \write18 is dangerous. We really don't want any way for arbitrary shell commands to be executed via the docs build. So the new text is:
It turns out that LaTeX enables \write18, which allows arbitrary shell commands to be executed from the document source, by default. This the often-seen warning during a pdfdocs build:
Quoted 5 lines
restricted \write18 enabled
That is a potential security problem and is entirely unnecessary; nothing in the kernel PDF docs build needs that capability. So disable \write18 explicitly.
I don't think the "restricted \write18 enabled" mode permits *arbitrary* shell commands. This is different from adding -shell-escape, rather the default option is -shell-restricted. In this mode, only those commands listed by "kpsewhich -var-value=shell_escape_commands" are allowed.
In my setting, it lists:
bibtex,bibtex8,extractbb,gregorio,kpsewhich,makeindex,repstopdf,r-mpost,texosquery-jre8,
As you can see, the format of the list indicates that the restriction concerns only the name of the command, which might be circumvented in a clever way :-/
-no-shell-escape is expected to plug the hole, but LaTeX/TeX implementation might have an unknown security issue. Who knows!
Quoted 9 lines
I think I'll add a Cc: stable while I'm at it. I know of no actual threat, but this is best closed.
Thanks for fixing this,
jon
Thanks for the link.
This is useful in understanding the early days of Sphinx adoption.
I'm kind of worried that Linus might get another flashback seeing my updates in LaTeX preamble. ;-)
Thanks, Akira
Jonathan Corbet
maintainerQuoted 4 lines · Akira Yokosawa
I don't think the "restricted \write18 enabled" mode permits *arbitrary* shell commands. This is different from adding -shell-escape, rather the default option is -shell-restricted. In this mode, only those commands listed by "kpsewhich -var-value=shell_escape_commands" are allowed.
Ah, OK, I stand corrected on that, thanks. It's still worth turning off, but it wasn't quite as bad as I'd feared. Now that I've thoroughly showed my ignorance I think I'll just go get busy with something else..:)
Thanks,
jon