diff options
author | Simon McVittie <smcv@collabora.com> | 2022-12-12 16:06:53 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2023-01-12 15:13:34 +0000 |
commit | 0aa0284c102970df4a606c141a9adde90eb938a5 (patch) | |
tree | d7b63d616278e623c31438e0dd88853f5412ad20 | |
parent | fe49f8f7ca1c028eade229801980c7db379f440c (diff) | |
download | flatpak-0aa0284c102970df4a606c141a9adde90eb938a5.tar.gz |
exports: Test that a symlink to the root directory is rejected
Reproduces: https://github.com/flatpak/flatpak/issues/1357
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | tests/test-exports.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test-exports.c b/tests/test-exports.c index 235c515d..6be9567a 100644 --- a/tests/test-exports.c +++ b/tests/test-exports.c @@ -1360,6 +1360,7 @@ test_exports_unusual (void) { "home", FAKE_SYMLINK, "var/home" }, { "lib", FAKE_SYMLINK, "usr/lib" }, { "recursion", FAKE_SYMLINK, "recursion" }, + { "symlink-to-root", FAKE_SYMLINK, "." }, { "tmp", FAKE_SYMLINK, "TMP" }, { "usr/bin", FAKE_DIR }, { "usr/lib", FAKE_DIR }, @@ -1419,6 +1420,14 @@ test_exports_unusual (void) ok = flatpak_exports_add_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_ONLY, + "/symlink-to-root", &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTABLE_FILE); + g_test_message ("attempting to export /symlink-to-root: %s", error->message); + g_assert_false (ok); + g_clear_error (&error); + + ok = flatpak_exports_add_path_expose (exports, + FLATPAK_FILESYSTEM_MODE_READ_ONLY, "/tmp", &error); g_assert_no_error (error); g_assert_true (ok); |