nah's path-based classification does not resolve symbolic links before making decisions. A symlink pointing to a sensitive file bypasses the protection because nah evaluates the symlink path, not the target.
Steps to Reproduce
# Direct access to sensitive file — should be blocked or ask
nah test "cat /etc/shadow"
# Result: filesystem_read → allow (questionable but at least visible)
# Create symlink to sensitive file
mkdir -p /tmp/nah-test
ln -sf /etc/shadow /tmp/nah-test/harmless.txt
# Access via symlink — nah sees an innocent path
nah test "cat /tmp/nah-test/harmless.txt"
# Result: filesystem_read → allow
Expected Behavior
nah should resolve symlinks (via readlink -f or equivalent) before classifying paths, especially for Read/Write/Edit tool calls. At minimum, sensitive path checks should apply to the resolved target, not just the apparent path.
Impact
An LLM agent could create a symlink to ~/.ssh/id_rsa, ~/.aws/credentials, or .env files and then read them through the symlink path, bypassing nah's sensitive path protection entirely.
Suggested Fix
Before classifying, resolve the real path:
import os
real_path = os.path.realpath(apparent_path)
# Then classify based on real_path
This should apply to all tools that take file paths: Read, Write, Edit, Glob, Grep.
nah's path-based classification does not resolve symbolic links before making decisions. A symlink pointing to a sensitive file bypasses the protection because nah evaluates the symlink path, not the target.
Steps to Reproduce
Expected Behavior
nah should resolve symlinks (via
readlink -for equivalent) before classifying paths, especially for Read/Write/Edit tool calls. At minimum, sensitive path checks should apply to the resolved target, not just the apparent path.Impact
An LLM agent could create a symlink to
~/.ssh/id_rsa,~/.aws/credentials, or.envfiles and then read them through the symlink path, bypassing nah's sensitive path protection entirely.Suggested Fix
Before classifying, resolve the real path:
This should apply to all tools that take file paths: Read, Write, Edit, Glob, Grep.