summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2020-08-26 19:05:21 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2020-08-27 17:48:50 +0200
commitaafe1d36e0225f54db8ca2ba03d8b1981c2d09e0 (patch)
tree8e59a47035473e138427eb06e1bf8395e756b200 /tests
parentc0faab35fabb469e3945ad99c32f041d2d7a0dab (diff)
downloadflatpak-aafe1d36e0225f54db8ca2ba03d8b1981c2d09e0.tar.gz
context: Do some syntactic normalization on filesystems
Paths containing ".." are rejected: they're almost certainly a terrible idea. Paths containing "." or multiple slashes are syntactically normalized. This assumes that nobody is going to use "--filesystem=/foo/bar/" to mean "make /foo/bar available, unless it's a non-directory, in which case fail". Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-exports.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test-exports.c b/tests/test-exports.c
index 21d8329e..aaccfaf4 100644
--- a/tests/test-exports.c
+++ b/tests/test-exports.c
@@ -272,6 +272,9 @@ typedef struct
static const NotFilesystem not_filesystems[] =
{
{ "homework", G_OPTION_ERROR_FAILED },
+ { "xdg-download/foo/bar/..", G_OPTION_ERROR_BAD_VALUE },
+ { "xdg-download/../foo/bar", G_OPTION_ERROR_BAD_VALUE },
+ { "xdg-download/foo/../bar", G_OPTION_ERROR_BAD_VALUE },
{ "xdg-run", G_OPTION_ERROR_FAILED },
};
@@ -319,6 +322,8 @@ static const Filesystem filesystems[] =
{ "xdg-cache/Stuff", FLATPAK_FILESYSTEM_MODE_READ_WRITE },
{ "xdg-config", FLATPAK_FILESYSTEM_MODE_READ_WRITE },
{ "xdg-config/Stuff", FLATPAK_FILESYSTEM_MODE_READ_WRITE },
+ { "xdg-config/././///.///././.", FLATPAK_FILESYSTEM_MODE_READ_WRITE, "xdg-config" },
+ { "xdg-config/////", FLATPAK_FILESYSTEM_MODE_READ_WRITE, "xdg-config" },
{ "xdg-run/dbus", FLATPAK_FILESYSTEM_MODE_READ_WRITE },
};