aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-06-02 15:21:13 -0600
committerJohn MacFarlane <jgm@berkeley.edu>2021-06-02 15:21:13 -0600
commit311736fb0ae21e5b5c78d1ad6fa4b3f4840941f9 (patch)
tree6bd335a45c7749fbd009e08301957ba3d5295ffe /src/Text/Pandoc
parent2b5dad9912de659424246657c91f70417590c3fe (diff)
downloadpandoc-311736fb0ae21e5b5c78d1ad6fa4b3f4840941f9.tar.gz
Text.Pandoc.PDF: only print relevant part of environment on `--verbose`.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/PDF.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index 7fce17cea..f85ef5b1f 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -507,8 +507,20 @@ showVerboseInfo mbTmpDir program programArgs env source = do
UTF8.hPutStrLn stderr $
T.pack program <> " " <> T.pack (unwords (map show programArgs))
UTF8.hPutStr stderr "\n"
- UTF8.hPutStrLn stderr "[makePDF] Environment:"
- mapM_ (UTF8.hPutStrLn stderr . tshow) env
+ UTF8.hPutStrLn stderr "[makePDF] Relevant environment variables:"
+ -- we filter out irrelevant stuff to avoid leaking passwords and keys!
+ let isRelevant ("PATH",_) = True
+ isRelevant ("TMPDIR",_) = True
+ isRelevant ("PWD",_) = True
+ isRelevant ("LANG",_) = True
+ isRelevant ("HOME",_) = True
+ isRelevant ("LUA_PATH",_) = True
+ isRelevant ("LUA_CPATH",_) = True
+ isRelevant ("SHELL",_) = True
+ isRelevant ("TEXINPUTS",_) = True
+ isRelevant ("TEXMFOUTPUT",_) = True
+ isRelevant _ = False
+ mapM_ (UTF8.hPutStrLn stderr . tshow) (filter isRelevant env)
UTF8.hPutStr stderr "\n"
UTF8.hPutStrLn stderr "[makePDF] Source:"
UTF8.hPutStrLn stderr source