Skip to content

fix: install packages when the configuration folder is a symbolic link - #531

Merged
M4n0x merged 2 commits into
stablebox:mainfrom
sailedev:fix/530-linked-configuration-packages
Nov 11, 2026
Merged

M4n0x merged 2 commits into
stablebox:mainfrom
sailedev:fix/530-linked-configuration-packages

Conversation

@sailedev

Copy link
Copy Markdown
Contributor

Problem

With ~/.config/stablebar reached through a symbolic link, as in a dotfiles setup, every package install fails with "Package path escapes its directory: …/packages//." Fixes #530.

Changes

  • validatePackagePath resolves both paths with a new resolvingSymlinks(_:). Foundation's resolvingSymlinksInPath() returns a path that doesn't exist yet unchanged, links in its existing parent folders included, so the new version folder and a new ID's install record (packages/<id>/.source.json) never shared the resolved packages folder's prefix. The helper resolves the nearest existing ancestor and appends the missing components. A link counts as existing even when its target doesn't, so existing paths resolve exactly as before.
  • The same gap let a new version under a link at packages/<id> that leads outside packages pass the check; it's now refused.
  • PackagePathTests covers installing into a linked configuration folder, missing paths inside and outside a linked folder, and the link at packages/<id>.

Testing

  • swift build --build-tests, then swift test --skip-build: 742 tests passed.
  • Without the source change, all three new tests fail, one with the reported "Package path escapes its directory" error.
  • scripts/check.sh --quick and commitlint --from origin/main pass.
  • Not checked: installing from the Store in a built app; the tests install a local example package through WidgetPackageStore.install, the path a Store download takes after unpacking.

Merging

One commit; any merge method works.

🤖 Generated with Claude Code — Claude Opus 5.5 via Claude Code

Foundation's resolvingSymlinksInPath() returns a path that doesn't exist yet unchanged, links in
its existing folders included. With ~/.config/stablebar linked into a dotfiles checkout, a new
package version, and the install record of a new ID, never shared the resolved packages folder's
prefix, so every install failed with "Package path escapes its directory". The containment check
now resolves the nearest existing ancestor and appends the missing components, which also refuses
a new version under a link at packages/<id> that leads outside the packages folder.

Fixes stablebox#530

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sailedev
sailedev requested a review from Seb-GRAF as a code owner November 10, 2026 17:34
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Package path validation now resolves symbolic links in existing ancestors before checking containment. Tests cover installation and validation through linked configuration and package paths.

Changes: Package path validation

Layer / File(s) Summary
Resolve package paths
Sources/StableBar/WidgetPackage.swift
validatePackagePath uses resolvingSymlinks for containment checks. The helper resolves the nearest existing ancestor before appending missing path components.
Test linked package paths
Tests/StableBarTests/PackagePathTests.swift
Tests cover installation through a linked configuration folder, validation of a missing descendant under a linked package folder, and rejection of a package ID symlink that points outside the packages directory.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 33bfb

No merge-blocking issue was established. Dangling-symlink behavior remains unverified.

Security architecture risk: Low · up to 33bfb

The change strengthens package-path checks and restores installation through linked configuration folders. No introduced security regression was established, but dangling links and filesystem mutation between validation and use remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated security surface is the application's package filesystem boundary: package-file reads, installation destinations, and source-record paths. Exploiting validation-to-use mutation would require the ability to alter relevant filesystem paths; the inspected change does not establish a new privilege grant or broader service boundary.

Trust Boundaries and Controls

  • observed — Package IDs and versions remain restricted to validated path components. Containment compares the resolved target against the resolved root with a trailing directory separator. Configuration loading continues enforcing the package boundary before decoding included files, and package source-ownership checks remain ahead of installation copies.

Resilience and Maintainability Implications

  • inferred — Containment validation is not atomic with later filesystem use. An interruption after the package move but before source-record persistence can also leave files without their record. These windows predate the PR; the comparison does not establish that their exposure increased. Consequently, the change should not be interpreted as proving race-resistant containment or crash-atomic source ownership.
Pre-merge checks: Passed 3

Check name Status Explanation
Description check Passed The description includes the required Problem, Changes, Testing, and Merging sections. It reports test results, notes what was not checked, states the merge requirement, and ends with the model and ha…
Linked Issues check Passed [#530] validatePackagePath resolves the nearest existing ancestor before it appends missing components. This lets new package paths under a symlinked configuration folder pass containment checks, wh…
Out of Scope Changes check Passed The reviewed summary lists changes to package-path validation and focused tests for #530. The additional rejection test covers the path-escape case described in #530. No unrelated changes are indicate…
Full details: Description check

Explanation

The description includes the required Problem, Changes, Testing, and Merging sections. It reports test results, notes what was not checked, states the merge requirement, and ends with the model and harness.

Full details: Linked Issues check

Explanation

[#530] validatePackagePath resolves the nearest existing ancestor before it appends missing components. This lets new package paths under a symlinked configuration folder pass containment checks, while rejecting a new version path through a symlink that leaves packages. PackagePathTests exercises WidgetPackageStore.install through a linked configuration folder and tests both containment cases. The tests do not launch the Store UI or CLI, but they cover the shared install operation.

Full details: Out of Scope Changes check

Explanation

The reviewed summary lists changes to package-path validation and focused tests for #530. The additional rejection test covers the path-escape case described in #530. No unrelated changes are indicated.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ef6c09c and 33bfbc6.

Files selected for processing: 1

  • Sources/StableBar/WidgetPackage.swift

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@M4n0x M4n0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, the three tests fail without the fix and pass with it, approved the CI run too. Just a nitpick on the comment below

Comment thread Sources/StableBar/WidgetPackage.swift Resolved
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Before and after

main at a6b5371 → this pull request at 33bfbc6 · 60 screens drawn in one CI job · 0 changed

60 unchanged screens

docs/essentials-clock-settings-dark, docs/essentials-clock-settings-light, docs/essentials-dark, docs/essentials-light, docs/essentials-settings-dark, docs/essentials-settings-light, docs/hero-dark, docs/hero-light, docs/popups-dark, docs/popups-light, docs/settings-dark, docs/settings-light, docs/themes-dark, docs/themes-light, scenes/app-menu-popup-dark, scenes/app-menu-popup-light, scenes/apple-menu-settings-dark, scenes/apple-menu-settings-light, scenes/crowded-edit-bar-dark, scenes/crowded-edit-bar-light, scenes/dock-badges-bar-dark, scenes/dock-badges-bar-light, scenes/essentials-clock-popup-dark, scenes/essentials-clock-popup-light, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/horizontal-list-popup-light, scenes/notch-flare-bar-dark, scenes/notch-flare-bar-light, scenes/settings-bar-dark, scenes/settings-bar-light, scenes/settings-bar-placement-dark, scenes/settings-bar-placement-light, scenes/settings-general-dark, scenes/settings-general-light, scenes/settings-general-spaces-dark, scenes/settings-general-spaces-light, scenes/settings-theme-dark, scenes/settings-theme-light, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-uninstall-failed-light, scenes/settings-uninstall-light, scenes/settings-widget-backgrounds-dark, scenes/settings-widget-backgrounds-light, scenes/setup-look-below-menu-bar-dark, scenes/setup-look-dark, scenes/setup-permissions-dark, scenes/setup-placement-dark, scenes/setup-touches-dark, scenes/setup-try-dark, scenes/slider-end-stop-popup-dark, scenes/slider-end-stop-popup-light, scenes/starter-bar-dark, scenes/starter-bar-light, scenes/starter-edit-bar-dark, scenes/starter-edit-bar-light, scenes/update-popup-dark, scenes/update-popup-light

Visual review: 60 screens, none changed.

The story of the bug belongs to the pull request; the comment now says only
what the helper does for whoever reads it next.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@M4n0x
M4n0x merged commit 7e4f88b into stablebox:main Nov 11, 2026
15 checks passed
stablebar-releases Bot pushed a commit that referenced this pull request Nov 11, 2026
## [0.13.0](v0.12.0...v0.13.0) (2026-11-11)

### Features

* answer common questions and send feedback from a Help section ([#564](#564)) ([325083e](325083e))
* apply migrations to includes, packages and every screen setup's bar ([#539](#539)) ([6cc59f4](6cc59f4))
* check in setup that Workspaces can reach yabai or OmniWM ([#552](#552)) ([3a9ef7e](3a9ef7e)), closes [#463](#463)
* check the Switch to Desktop shortcuts in setup and Settings ([#551](#551)) ([92c11e1](92c11e1)), closes [#447](#447)
* follow Reduce Transparency and Increase Contrast ([#542](#542)) ([3ea111b](3ea111b))
* guide Accessibility access with a panel to drag StableBar into System Settings ([#559](#559)) ([29f000c](29f000c))
* pause scripts and providers while the displays sleep or the screen is locked ([#538](#538)) ([a09513d](a09513d))
* sign updates with an EdDSA key as well as the Developer ID ([#540](#540)) ([7e34d56](7e34d56))
* turn on Keep windows clear in setup when no window manager runs ([#553](#553)) ([a80b001](a80b001)), closes [#466](#466) [#439](#439)

### Bug Fixes

* follow Reduce Motion in setup's steps, theme row and tiles ([9c3f0c4](9c3f0c4)), closes [#465](#465)
* install packages when the configuration folder is a symbolic link ([#531](#531)) ([7e4f88b](7e4f88b)), closes [#530](#530)
* keep setup's later choices when the preset changes ([3318ae0](3318ae0)), closes [#461](#461)
* keep the website's Store review sheet inside its window ([9519645](9519645)), closes [#526](#526)
* leave windows alone until setup finishes ([#547](#547)) ([c9b75cf](c9b75cf)), closes [#466](#466)
* let a group wider than its tray scroll sideways while editing the bar in place ([#543](#543)) ([f6e6e25](f6e6e25))
* make setup's tiles, closing card and permission buttons work with the keyboard and VoiceOver ([#554](#554)) ([0944100](0944100)), closes [#464](#464)
* offer Keep notifications clear only on macOS 26 and later ([#550](#550)) ([5fd428a](5fd428a)), closes [#458](#458)
* offer the Notch preset only on Macs with a notch ([#548](#548)) ([3fef60f](3fef60f)), closes [#457](#457)
* open an app's own menu when Menu bar items can't draw its rows ([#541](#541)) ([24f16d7](24f16d7))
* shorten long errors in the bar's menus and open Status from them ([#536](#536)) ([5710a3e](5710a3e))
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.13.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Packages can't be installed when the configuration folder is a symbolic link

2 participants