CI / build (push) Has been cancelled
Batch 1 (High severity): - Bug 1: --audit cat3 now checks .automaton/tasks/ paths - Bug 4: Verdict PASS/FAIL uses structured ## Status: line parsing - Bug 5: register-guards.sh checks .json/.jsonc, writes plugin key, strips comments - Bug 7: --can-edit/--scope-check path prefix uses os.sep boundary Batch 2 (Medium/Low severity): - Bug 2: migrate-project.sh find command parentheses for -prune binding - Bug 3: vram_detect model prefix matching with known-suffix whitelist - Bug 6: dashboard reads .state file before artifact heuristic fallback - Bug 8: removed wildcard CORS, added security headers (nosniff, DENY) - Bug 9: stale-task detection uses .state.lastedit instead of .state mtime - Bug 10: TEST_PLAN.md maps to test_design (was implement) 249 tests pass (up from 235). All 10 tasks driven through full workflow to completion.
1.3 KiB
1.3 KiB
Spec: fix-can-edit-path-prefix
Problem
--can-edit and --scope-check in scripts/status.py use str(file_path).startswith(proj_str) to verify a file is within the project directory. String startswith matches sibling directories: /home/user/project-evil/file.py matches prefix /home/user/project. This allows editing files outside the project boundary.
Affected locations:
scripts/status.py:951(--can-edit --project --file)scripts/status.py:1004(--can-edit --task --file, framework case)scripts/status.py:1010(--can-edit --task --file, regular project case)scripts/status.py:1047(--scope-check)scripts/status.py:1052(--scope-check, framework check)
Fix
Append a trailing path separator to the prefix before comparison:
str(file_path).startswith(proj_str + os.sep)
Or use Path.relative_to() which correctly resolves path boundaries:
try:
file_path.relative_to(project_dir.resolve())
except ValueError:
# out of scope
Acceptance Criteria
- A file in
/home/user/project-evil/is correctly rejected as out-of-scope when project is/home/user/project - A file in
/home/user/project/subdir/is correctly accepted as in-scope - Both framework and regular project cases work
- Add a test in
tests/test_status.pycovering the sibling-directory edge case