fix: add -n to ln -sf in install.sh to prevent symlink TOCTOU (PILOT-271)#190
fix: add -n to ln -sf in install.sh to prevent symlink TOCTOU (PILOT-271)#190matthew-pilot wants to merge 1 commit into
Conversation
…ILOT-271) The writable-check then ln -sf in install.sh:342-349 is non-atomic. Without -n (--no-dereference), if an attacker races between the check and the ln call to replace the destination path with a symlink to a directory, ln would follow it and create the link inside that directory instead of replacing it. Adding -n makes ln treat the destination as a non-directory, preventing symlink dereference. Fixes: PILOT-271
🦀 Matthew PR Check — #190 PILOT-271Status
CI NoteArchitecture gates failures are pre-existing (consistent pattern across all shell-only install.sh PRs — not introduced by this change). |
🦀 Matthew Explains — #190 PILOT-271What this doesAdds WhyThe pattern in if [ -w "$TARGET" ]; then ... ; fi
ln -sf "$SOURCE" "$TARGET"The writable-check then
Risk beforeLow — requires local filesystem write access in a directory the user already controls (typically Scope
|
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect: @matthew-pilot — fix or comment. Auto-classified at 2026-06-02T20:20:00Z. Re-runs on next push or check completion. |
🦾 Matthew PR Status — #190Title: fix: add -n to ln -sf in install.sh to prevent symlink TOCTOU (PILOT-271) TicketsLabelsNone Files Changed
Next Actions
🦾 Auto-generated status check by matthew-pr-worker |
🦾 Matthew PR Explain — #190What this PR doesfix: add -n to ln -sf in install.sh to prevent symlink TOCTOU (PILOT-271) Scope
TicketsFiles
Review Notes
🦾 Auto-generated explain by matthew-pr-worker |
📊 PR Status — PILOT-271PR State: OPEN · Not draft · Canary: ❌ failed — Jira PILOT-271: TO DO · Unassigned · Labels:
Last operator activity: Jira updated 2026-05-31 13:54 EEST, PR updated 2026-05-31 16:39 UTC ⚡ Fix: added -n to ln -sf to prevent symlink TOCTOU race. Canary failed — needs operator review. |
What
Adds
-n(--no-dereference) flag to allln -sfcalls in the install.sh symlink section.Why
The writable-check then
ln -sfin install.sh:342-349 is non-atomic (TOCTOU). Without-n, if an attacker races between the check and thelncall to replace a destination path with a symlink to a directory,lnwould follow it and create the link inside that directory instead of at the intended location.ln -sfntreats the destination as a non-directory, preventing symlink dereference.Change
nto eachln -sf→ln -sfnVerification
bash -n install.sh— syntax OKgo build ./...— greengo vet ./...— greenFixes: PILOT-271