diff --git a/plugins/permission-gateway/scripts/permission-gate.sh b/plugins/permission-gateway/scripts/permission-gate.sh index f4d91c7..8f85b2f 100755 --- a/plugins/permission-gateway/scripts/permission-gate.sh +++ b/plugins/permission-gateway/scripts/permission-gate.sh @@ -458,7 +458,7 @@ fi # --- Tier 1: Safe patterns --- # Safe read-only commands (anchored to start — first command in chain) -if echo "$command_normalized" | grep -qE '^(ls|cat|head|tail|wc|jq|echo|pwd|which|whoami|date|file|stat|diff|sort|uniq|tr|cut|tee|less|more|env|printenv|type|grep|rg|find|fd|tree|awk|sed|hexdump|hex|xxd|od)\b'; then +if echo "$command_normalized" | grep -qE '^(ls|cat|head|tail|wc|jq|echo|pwd|which|whoami|date|file|stat|diff|sort|uniq|tr|cut|tee|less|more|env|printenv|type|grep|rg|find|fd|tree|awk|sed|hexdump|hex|xxd|od|basename|dirname|realpath|cd)\b'; then approve fi diff --git a/plugins/permission-gateway/tests/test-permission-gate.sh b/plugins/permission-gateway/tests/test-permission-gate.sh index 1986c45..2ea6452 100755 --- a/plugins/permission-gateway/tests/test-permission-gate.sh +++ b/plugins/permission-gateway/tests/test-permission-gate.sh @@ -78,6 +78,9 @@ assert_decision "type" "type node" "silent" assert_decision "cargo bench" "cargo bench" "silent" assert_decision "npm ci" "npm ci" "silent" assert_decision "jj bookmark" "jj bookmark create feature-x" "silent" +assert_decision "basename" "basename /some/path" "silent" +assert_decision "dirname" "dirname /some/path/file.txt" "silent" +assert_decision "cd" "cd /some/dir" "silent" assert_decision "sed (piped)" "echo hello | sed 's/hello/world/'" "silent" assert_decision "sed (no -i)" "sed 's/foo/bar/' file.txt" "silent" assert_decision "hexdump" "hexdump -C binary.bin" "silent"