fix(security): allow linked worktrees below config roots#1301
Open
WangErgouaaaa wants to merge 2 commits into
Open
fix(security): allow linked worktrees below config roots#1301WangErgouaaaa wants to merge 2 commits into
WangErgouaaaa wants to merge 2 commits into
Conversation
added 2 commits
July 16, 2026 00:49
Agent harnesses place legitimate task worktrees below ~/.config, which the sensitive-path guard previously rejected wholesale. Permit only Git-linked worktrees whose standard main checkout is outside every protected home directory, while preserving the block for ordinary config paths and all other sensitive roots. Constraint: ~/.ssh, ~/.gnupg, and ~/.aws must remain unconditional denials Rejected: Allow every Git repository under ~/.config | ordinary repositories there are still configuration data and should remain protected Confidence: high Scope-risk: narrow Directive: Do not widen this exception beyond verified linked worktrees without equivalent boundary tests Tested: security and worktree suites; full build; full suite 2373 passed with 2 host EMFILE watcher failures unrelated to this change Not-tested: Windows linked-worktree layout
A linked worktree under ~/.config can legitimately share its Git directory with a primary checkout that is also under ~/.config. Keep the exception limited to roots with a .git file and a distinct shared checkout, while ordinary config repositories remain blocked. Tested: focused RED/GREEN regression; 63 security/worktree tests; TypeScript build; actual worktree validation; full suite 2375 passed, 4 skipped.
Author
|
Local runtime acceptance completed against the PR branch:
Full branch suite remains |
Author
|
Post-closeout acceptance on the original affected worktree is complete: The patched CLI successfully executed: and returned The safety control also passed:
The two pre-existing source modifications in the affected worktree remained |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.configwhen its primary checkout isalso below
~/.config.gitfile and adistinct shared Git checkout
Root cause
The sensitive-path guard rejected every descendant of
~/.config. The firstlinked-worktree exception still required the primary checkout to live outside
all protected home directories, but agent harnesses can place both the primary
checkout and its linked task worktree below
~/.config/superpowers/worktrees.Verification
~/.configsandbox, then GREEN after the fixsecurity.test.ts+worktree-detection.test.ts: 63 passed, 2 skippedvalidateProjectPath(...) === nulluninitialized-index response
Security boundary
~/.ssh,~/.gnupg, and~/.awsremain unconditional denials~/.configremains denied because its.gitis adirectory, not a linked-worktree pointer file