From 6065a0c20ac34a032d2e50108a440c284a06be5b Mon Sep 17 00:00:00 2001 From: fedir Date: Tue, 6 May 2025 12:18:45 +0200 Subject: [PATCH] Added permissions globbing tests --- test/test.bash | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/test.bash b/test/test.bash index 698530f..ba0d9c8 100755 --- a/test/test.bash +++ b/test/test.bash @@ -9,6 +9,13 @@ touch ./protected/do-not-remove ./protected/should-be-removed ./protected/truth chmod 777 ./protected/perm777 ./protected/perm000 echo "Free code, free world." >./protected/motto +mkdir protected/haystack +for i in {1..10}; do + touch "./protected/haystack/hay$i" +done +touch ./protected/haystack/needle +echo "Liberty in every line." >./protected/haystack/needle + rm -rf ./openers mkdir openers make -C ./opener || ( @@ -151,9 +158,22 @@ openers/symlinked_opener2 ./protected/motto >/dev/null 2>/dev/null && echo "[ICFS-TEST]: openers/symlinked_opener2 can read protected/motto despite access being denied!" || echo "[ICFS-TEST]: OK" # EACCESS +# test permission globbing + +icfs_dialogue --set-fake-response yes_perm +icfs_dialogue --set-fake-response-filename "/" +grep 'Liberty' ./protected/haystack/needle >/dev/null && + echo "[ICFS-TEST]: OK" || + echo "[ICFS-TEST]: grep cannot read protected/motto despite access being permitted!" # OK + +icfs_dialogue --set-fake-response no # this should be ignored +grep "Liberty" ./protected/haystack/* >/dev/null && + echo "[ICFS-TEST]: OK" || + echo "[ICFS-TEST]: grep cannot read protected/motto despite access being permitted!" # OK + # test database access if [[ -r "./.pt.db" || -w "./.pt.db" ]]; then - echo "[ICFS-TEST]: permanent permissions is accessible!" + echo "[ICFS-TEST]: permanent permissions database is accessible!" else echo "[ICFS-TEST]: OK" fi