Reject symlinked Linux update staging folders #1343
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1343
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/linux-staging-leaf"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reject a pre-existing symbolic link at
versions/<tag>.partbefore stale-folder cleanup, part placement or download. Leave the link untouched and report the exact staging path through the existing update-error flow. Symlinked parent installation roots remain supported.Current main reaches cleanup or part placement before failing on these links. Pending #1327 canonicalizes the staging root in
_place, so a dangling staging leaf can instead select its resolved target before the new ZIP checks. This is a separate leaf check; it does not duplicate or change #1327's archive containment rules.Thanks to @Demonicmurderer for #1295 and @bronze-ff for the related #1327.
Validation:
The new regression uses temporary paths and doubles, with no network or real archive/installer execution. The existing Linux-only test scope is retained; no Windows symlink privilege is required. This does not establish archive integration coverage or protection against concurrent replacement of the staging leaf.
All eight hosted validation checks pass on
b65d80e, including Linux/Windows source checks, the Windows Builder/setup and renderer builds, and the Linux AppImage. Release publishing is skipped for the PR.Looks good. The guard sits right before the isdir/rmtree, so a symlinked
v2.partis rejected before cleanup, placement or download, and the ValueError goes out through the existingupdate-errorpath in hookshot_builder.py. Usingislink(notisdir) also covers the dangling-link case, which main would otherwise walk straight into via_place's makedirs. CI is green, including the Linux and Windows source checks and the AppImage.Overlap with #1327: complementary, not a duplicate. #1327 changes
_unpackand_place(realpath check on the part directory,xbopen); this only touchesinstall()before any of that runs. The two diffs are in different hunks and the test additions are in different places in test_linux_update.py, so I don't expect a textual conflict. Behaviour-wise, #1327's_placecheck would also reject a symlinked staging leaf, just later and with a different message; with this guard in place it never gets that far, so the two don't fight. Worth landing both.Nit, no action needed: the leaf check is still racy against something swapping the link in after the check, which the description already says it doesn't cover.