Skip to content

fix: prevent staging symlinks from overwriting unrelated files - #15

Merged
bfirestone merged 1 commit into
mainfrom
fix/symlink-detection-overwrite
Sep 18, 2026
Merged

bfirestone merged 1 commit into
mainfrom
fix/symlink-detection-overwrite

Conversation

@bfirestone

Copy link
Copy Markdown
Contributor

An existing <target>.new symlink could redirect replacement writes and chmod to an unrelated file. Create an exclusive, uniquely named temporary file beside the executable, write through its original handle, then close and atomically rename it over the target. Remove that temporary file on failure and preserve permission-error reporting.

Leave conventional .new files and symlinks untouched. Retain the public ArchiveInstaller.Sweep method as a deprecated no-op for compatibility. Document that crashes may leave hidden temporary files and that the installation directory must remain trusted. Also fix an existing macOS signing-comment lint failure.

Validation:

  • New symlink regressions fail against the original code for both successful and partially failed writes, and pass with the fix.
  • go test -race -count=1 ./... passes, including end-to-end tests.
  • go build ./... and go vet ./... pass.
  • golangci-lint run ./... reports zero issues; formatting and whitespace checks pass.

Arc: selfupgo-19e4.09mq4z

@bfirestone
bfirestone merged commit 58870ec into main Sep 18, 2026
3 checks passed
@bfirestone
bfirestone deleted the fix/symlink-detection-overwrite branch September 18, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant