fix(install): refuse uninstall when PILOT_DIR is a symlink (PILOT-273)#192
fix(install): refuse uninstall when PILOT_DIR is a symlink (PILOT-273)#192matthew-pilot wants to merge 1 commit into
Conversation
install.sh uninstall path removes $PILOT_DIR via rm -rf, which follows symlinks — if $HOME/.pilot was swapped to a symlink, the target directory gets clobbered with no warning. Added a -h test before -d: if PILOT_DIR is a symlink, the uninstall aborts with an error message instead of following it. Combined with the ln -sfn fix from PILOT-271, this closes a second symlink footgun in the install/uninstall paths. Closes PILOT-273
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect: @matthew-pilot — fix or comment. Auto-classified at 2026-05-30T17:05:00Z. Re-runs on next push or check completion. |
🦞 Matthew PR Check — #192 PILOT-273Status
VerdictCLEAN — tiny shell change, 4-line symlink guard. Go tests green on both platforms. Arch gates failures are pre-existing CI infra noise. |
🦞 Matthew Explains — #192 PILOT-273What this doesAdds a symlink check in
if [ -h "$PILOT_DIR" ]; then
echo " Refusing to uninstall: $PILOT_DIR is a symlink"
exit 1
fiWhy
ContextPairs with PR #190 ( |
What failed
install.shuninstall path (line 122) removes$PILOT_DIRviarm -rf, which follows symlinks. If~/.pilotwas swapped to a symlink by a concurrent attacker,rm -rffollows it and clobbers the target directory — not the symlink itself.Why this fix
Added a
-h(symlink) test before the-d(directory) test. IfPILOT_DIRis a symlink, the uninstall aborts with an error message and exit code 1 instead of following the link.Change: 1 file, +4 lines
Verification
go build ./...✓go vet ./...✓Combined with the
ln -sfnfix from PILOT-271 (PR #190), this closes a second symlink footgun in the install/uninstall paths.Closes PILOT-273