Skip to content

Fix critical security findings from codebase review#42

Merged
AnExiledDev merged 3 commits intostagingfrom
worktree-codebase-review-fixes
Mar 2, 2026
Merged

Fix critical security findings from codebase review#42
AnExiledDev merged 3 commits intostagingfrom
worktree-codebase-review-fixes

Conversation

@AnExiledDev
Copy link
Owner

Summary

Addresses 8 findings from full codebase security/quality review (1 critical, 5 high, 2 medium/low):

  • S2-01 (CRITICAL): Removed env var injection vector in agent redirect log path — hardcoded /tmp/agent-redirect.log
  • S2-04 (HIGH): Protected files guards now fail closed on unexpected errors (sys.exit(2) instead of sys.exit(0))
  • S2-03 (HIGH): Hardened dangerous command blocker — prefix stripping (\rm, command rm, env rm), symbolic chmod (a=rwx, 0777, u+s), docker system/volume, git filter-branch, plus-refspec force push
  • C1-02 (HIGH): Unified write-target extraction patterns — protected-files bash guard expanded from 5 → 18 patterns to match workspace scope guard
  • Q3-01 (HIGH): Fixed greedy alternation bug in redirect regex (>|>>>>|>)
  • Q3-08 (HIGH): Added pytest to CI pipeline (test-plugins job) + staging branch triggers
  • Q3-04 (LOW): Bare git stash (equivalent to push) now blocked in read-only mode
  • S2-09 (MEDIUM): Narrowed configApply allowed destinations from /usr/local to /usr/local/share

Changes

File Change
redirect-builtin-agents.py Hardcoded log path, removed import os
guard-protected.py Exception handler: exit(0) → exit(2)
guard-protected-bash.py exit(0)→exit(2), 5→18 write patterns, `>>
guard-workspace-scope.py `>>
block-dangerous.py Prefix stripping + 11 new patterns
guard-readonly-bash.py Bare git stash blocking
setup.js /usr/local/usr/local/share
ci.yml test-plugins job + staging triggers
CHANGELOG.md Entries for all changes
4 test files 36 new test cases (241 → 277 total)

Test plan

  • npm test — 18/18 Node.js tests pass
  • pytest tests/ -v — 277/277 Python tests pass
  • All new bypass vectors covered by test cases
  • CI workflow syntax validated
  • Verify CI test-plugins job runs on PR

- Remove env var injection in agent redirect log path (S2-01)
- Protected files guards fail closed on unexpected errors (S2-04)
- Harden dangerous command regexes: prefix stripping, symbolic chmod,
  setuid, docker system/volume, git filter-branch, plus-refspec (S2-03)
- Unify write-target patterns across guards (5 → 18 patterns) (C1-02)
- Fix greedy alternation in redirect regex (>>|> order) (Q3-01)
- Block bare git stash in read-only mode (Q3-04)
- Narrow configApply allowed destinations to /usr/local/share (S2-09)
- Add pytest to CI pipeline (Q3-08)
- Add 36 new test cases covering all fixes (241 → 277 tests)
@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch worktree-codebase-review-fixes

Comment @coderabbitai help to get the list of available commands and usage tips.

- Version 1.14.2 → 2.0.0
- prepublishOnly now runs npm run test:all (Node + Python tests)
- Sync README version to match package.json
The test hardcoded /home/vscode but CI runs as /home/runner.
Use the module's _home variable to match the actual environment.
@AnExiledDev AnExiledDev merged commit a46a598 into staging Mar 2, 2026
5 checks passed
@AnExiledDev AnExiledDev deleted the worktree-codebase-review-fixes branch March 2, 2026 03:23
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