Skip to content

fix(security): warn on worktree accumulation (closes #17) - #23

Merged
axisrow merged 1 commit into
mainfrom
sec-worktree-accumulation-warn
Jul 20, 2026
Merged

axisrow merged 1 commit into
mainfrom
sec-worktree-accumulation-warn

Conversation

@axisrow

@axisrow axisrow commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Closes #17 (MEDIUM). Leave-branch never removes worktrees, so they accumulate indefinitely. Add stderr warning at threshold (default 10, configurable via CODEX_WORKTREE_WARN_THRESHOLD). Not fail-closed. 19/19 tests, 162 pass / 4 pre-existing.

Leave-branch cleanup never removes worktrees, so each rescue call adds a
new .worktrees/codex-<ts>/ + branch indefinitely. Add a stderr warning when
existing worktree count reaches a threshold (default 10, configurable via
CODEX_WORKTREE_WARN_THRESHOLD). Not fail-closed — leave-branch contract
preserved. Regression test: create threshold+1 worktrees, assert warn.

Verified: worktree 19/19; full npm test 162 pass / 4 pre-existing.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@axisrow
axisrow force-pushed the sec-worktree-accumulation-warn branch from 90cf087 to 3061fe3 Compare July 20, 2026 10:21
@axisrow

axisrow commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

Cycle 1: Codex MEDIUM (readdirSync before #14 guard — symlink enumeration) + Claude polish (Number('0')||10 = 10). Both fixed in 3061fe3: lstat before readdirSync + proper threshold parsing. 19/19 tests. Ready to merge.

@axisrow
axisrow merged commit fce0e8a into main Jul 20, 2026
@axisrow
axisrow deleted the sec-worktree-accumulation-warn branch July 20, 2026 10:22
axisrow added a commit that referenced this pull request Jul 20, 2026
Security hardening release: leave-branch worktree cleanup (#12) + 4 security
fixes (#18 symlink guard, #20 core.symlinks=false neutralize, #22 eliminate
info/exclude write, #23 accumulation warn). rescue default --background (#8).
test-teardown (#5). All verified with cycle-review.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

security(medium): unbounded worktree accumulation (leave-branch) → disk exhaustion

1 participant