summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Brenden <evenbrenden@gmail.com>2022-01-27 23:59:20 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2022-01-28 08:51:27 -0800
commitd36a16a4df5ed54b80dfc1579c339bad24ba6b0c (patch)
treed07ed9859f4f9664552316d2f499eb7c55a37b8a /test
parente1f8c4b396354f8bf29c3b9f04e9b3f980c70d31 (diff)
Don't read files outside of user data directory
If a file path does not exist relative to the working directory, but it does exist relative to the user data directory, and it exists outside of the user data directory, do not read it. This applies to readDataFile and readMetadataFile in PandocMonad and, by extension, any module that uses these by passing them relative paths.
Diffstat (limited to 'test')
-rw-r--r--test/command/7861.md7
-rw-r--r--test/command/7861.yaml0
-rw-r--r--test/command/7861/metadata/placeholder0
3 files changed, 7 insertions, 0 deletions
diff --git a/test/command/7861.md b/test/command/7861.md
new file mode 100644
index 000000000..a5b68de6f
--- /dev/null
+++ b/test/command/7861.md
@@ -0,0 +1,7 @@
+```
+% pandoc -s -t native --data-dir=command/7861 --metadata-file=../../7861.yaml
+Hello
+^D
+2> Could not find metadata file ../../7861.yaml
+=> 98
+```
diff --git a/test/command/7861.yaml b/test/command/7861.yaml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/command/7861.yaml
diff --git a/test/command/7861/metadata/placeholder b/test/command/7861/metadata/placeholder
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/command/7861/metadata/placeholder