Fix scope guard false positives on system paths#49
Open
AnExiledDev wants to merge 8 commits intomainfrom
Open
Conversation
Scope guard: resolve CWD with realpath to prevent symlink mismatches, detect .claude/worktrees/ and expand scope to project root so sibling worktrees aren't blocked, and improve error messages with resolved paths. Stop hooks: add 5-minute per-session cooldown to commit-reminder and spec-reminder to prevent repeated firing in team/agent scenarios.
resolve_scope_root() now walks up from CWD looking for .git to find the repository root, preventing false positives when working in subdirectories like cli/, src/, or tests/. Safety ceiling at /workspaces prevents scope from escaping the workspace boundary.
Move .git/ to project root so the entire workspace is tracked in a single repository. Git detects all container-root files as renames into the container/ subdirectory. Root-level files (.github/, LICENSE.txt, CLA.md, CONTRIBUTING.md, .gitattributes) remain at the repository root. The docs/ package was already tracked at docs/ and is unaffected by this change. This is a structural reorganization — no code changes.
Add codeforge-cli v0.1.0 (Bun/TypeScript) — a CLI for CodeForge development workflows including session search, plan management, and task tracking. The docs package was already tracked from the previous repository structure.
CI workflows: - Add working-directory: container to all container job steps - Add path filters (container/**, cli/**) to trigger workflows selectively - Add test-cli job using Bun for CLI package - Update changelog/package.json paths for container subdirectory - Update devcontainer feature publish paths Config: - Add repository.directory to container and cli package.json - Remove docs:* scripts from container (docs is now a sibling package) - Simplify container/.gitignore (root handles shared patterns) - Update dependabot directories for monorepo layout Docs: - Add root README.md with monorepo overview and package table - Add root CLAUDE.md with branching strategy and dev rules - Update container/CLAUDE.md to reference root for shared rules
Update sync-changelog.mjs to read from container/.devcontainer/CHANGELOG.md instead of the old .devcontainer/CHANGELOG.md path. Regenerate the docs changelog page with updated source reference.
Scope guard now only enforces isolation between workspace projects. Paths outside the workspace (e.g. /dev/null, /usr/, /etc/) are not this guard's jurisdiction — other guards handle system-level security. Removes the complex system-command exemption logic that was insufficient and fragile.
|
Important Review skippedToo many files! This PR contains 299 files, which is 149 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (299)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
The redirect patterns matched text content inside command arguments (e.g. PR body text containing example paths), causing false positives. Write location enforcement is the scope guard's responsibility, not the dangerous-command-blocker's.
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
/workspaces/(/dev/null,/usr/,/etc/,$HOME/) are no longer blockedSYSTEM_COMMANDS,SYSTEM_PATH_PREFIXES,ALLOWED_PREFIXES,is_allowlisted()) — replaced by a singleis_outside_workspace()checkTestIsOutsideWorkspacetest class and updates bash scope test casesRoot cause: The guard treated every resolved path not under
cwdas a violation, with a fragile allowlist/system-command exemption that missed common patterns likecommand 2>/dev/null.Fix principle: If a resolved path doesn't start with
/workspaces/, it's outside this guard's jurisdiction. Other guards (dangerous-command-blocker, protected-files-guard) handle system security.Test plan
python -m pytest tests/plugins/test_guard_workspace_scope.py -v)command 2>/dev/null— allowedecho x > /usr/local/bin/foo— allowed/workspaces/other/) — still blocked/workspaces/.devcontainer/) — still enforced