You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security(files): a hard link to a sensitive file under another name is read verbatim #703
Left over from #683 (the optional part of its suggested fix; PR #698 did the name rules and the configurable list).
Problem
is_sensitive_name checks the requested name and the canonical path. A hard link to .env (or any other sensitive file) under an innocuous name is neither, so read_file (ReadOnly, no approval) returns it verbatim. Severity: low; creating the link needs a command the owner approved.
Fix
In read_file and the other readers that use the sensitive rule: on a regular file with nlink > 1, treat it as sensitive unless every other name can be shown to be non-sensitive (cheap rule: nlink > 1 inside the workspace is withheld and the refusal points to read_file_raw).
Unix only; no-op elsewhere. No extra directory scan, just metadata().nlink().
Test: a hard link notes.txt to .env is withheld; a normal single-link file is not; a link outside the sensitive rule list stays readable when nlink == 1.
Activity
fix(security): read_file withholds a file with more than one hard link