Skip to content

Allow verified linked worktrees under ~/.config#1293

Open
WangErgouaaaa wants to merge 1 commit into
colbymchenry:mainfrom
WangErgouaaaa:fix/linked-worktree-sensitive-path-20260716
Open

Allow verified linked worktrees under ~/.config#1293
WangErgouaaaa wants to merge 1 commit into
colbymchenry:mainfrom
WangErgouaaaa:fix/linked-worktree-sensitive-path-20260716

Conversation

@WangErgouaaaa

Copy link
Copy Markdown

Summary

CodeGraph currently rejects every project path below ~/.config as sensitive. Agent harnesses can legitimately place task-owned Git linked worktrees there, so those worktrees cannot be indexed even when their main checkout is outside every protected home directory.

This change permits only that verified linked-worktree case while retaining the existing denial for ordinary config directories and for .ssh, .gnupg, and .aws.

Security boundary

The exception requires all of the following:

  • Git resolves a distinct linked-worktree root
  • the worktree has a .git file
  • its shared common directory is a standard .git directory
  • the main checkout is outside every sensitive home directory

An ordinary directory or standalone repository below ~/.config remains blocked.

Test plan

  • npm run build
  • npx vitest run __tests__/security.test.ts __tests__/worktree-detection.test.ts — 63 passed, 2 skipped
  • manual built-output check: a real linked worktree below ~/.config is accepted while an ordinary config directory is rejected
  • git diff --check

Full-suite note

The local full suite reached 2373 passed and 4 skipped. Two filesystem-watcher tests timed out after the host reported EMFILE: too many open files; rerunning those tests alone reproduced the same host-level watcher exhaustion.

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
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