Repository navigation
fix: confine editor workspace files to the selected worktree - #223
Conversation
|
No actionable comments were generated in the recent review. WalkthroughWorkspace file resolution now rejects paths that do not resolve inside the selected worktree, including symlink targets. Invalid explicit paths open the worktree folder without auto-detection. Documentation and regression tests cover the policy and supported path cases. ChangesEditor workspace selection
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk:
|
Description
Configured editor workspace files can currently resolve outside the selected worktree. For example, with a workspace-capable editor already selected,
editor.workspace = ../../outside.code-workspacepasses that existing external file to the editor.Require workspace files from every config source to resolve inside the physical worktree root, including symlink targets. Invalid or missing explicit paths open the worktree folder without triggering auto-detection. Preserve nested paths, spaces, internal symlinks, configuration precedence, root auto-detection, and
none. Valid paths retain their spelling so workspace-relative editor settings keep their meaning.Motivation
Related: VULN-604.
A benign fake editor reproduced external-file argument selection on
2d4852d. The demonstrated impact is local argument selection; no GTR shell execution or actual editor trust bypass was demonstrated. The shared workspace setting remains data, while selecting an editor through shareddefaults.editorstill requires command approval.Type of Change
Testing
After rebasing onto
801f33c:bats tests/workspace.bats tests/adapters.bats tests/launch.bats tests/cmd_help.bats: 64 passed, including 18 new workspace regressions../scripts/generate-completions.sh --check: passed.git diff --check: passed.Earlier validation on the original
2d4852dbase:bats tests/run: 609 passed, 12 failed. All 12 failures also reproduced on an unmodified baseline in this macOS environment: three PR/SSH URL cases, two debug-trap cases, six generated-shell/fish cases, and one macOS terminal-quoting case. This is not a green full-suite claim for the rebased branch.git gtr new --editor, plus config, go, list, run, and removal: passed on macOS Bash 3.2.Manual Testing Checklist
Breaking Changes
Outside-worktree paths in local/global Git config as well as shared config now fall back to opening the folder. Configure a workspace file located inside the selected worktree, or open an external workspace directly in the editor. README, configuration documentation, and CLI help describe the policy.
Checklist
Additional Context
Containment checks the workspace file itself, not the folders or settings described inside it. Editor trust remains the editor's responsibility. Validation is not atomic with editor launch and cannot prevent filesystem changes after the check. No real-editor trust UI, live exploits, or customer data were used.
License Acknowledgment
This contribution is submitted under the Apache License 2.0.
Summary by CodeRabbit
New Features
.gtrconfigstill requires trust.Documentation