Fix 10 audit bugs: path prefix matching, verdict parsing, CORS, stale-task detection, phase mapping
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.
This commit is contained in:
Lap Tran
2026-06-22 10:40:58 -04:00
parent f32f98575b
commit 81ccf548e5
106 changed files with 1643 additions and 436 deletions
+5 -5
View File
@@ -89,9 +89,9 @@ def test_static_valid_file(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> N
class TestCORSAndSecurityHeaders:
"""Tests for CORS and security headers on API responses."""
"""Tests for security headers on API responses (no CORS wildcard)."""
def test_send_json_includes_cors(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
def test_send_json_no_cors_wildcard(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
html_dir = tmp_path / "html"
html_dir.mkdir()
monkeypatch.setattr(DashboardHandler, "dashboard_path", html_dir)
@@ -105,10 +105,10 @@ class TestCORSAndSecurityHeaders:
handler._send_json({"test": True})
header_dict = dict(response_headers)
assert header_dict.get("Access-Control-Allow-Origin") == "*"
assert "Access-Control-Allow-Origin" not in header_dict
assert header_dict.get("X-Content-Type-Options") == "nosniff"
def test_send_error_includes_cors(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
def test_send_error_no_cors_wildcard(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
html_dir = tmp_path / "html"
html_dir.mkdir()
monkeypatch.setattr(DashboardHandler, "dashboard_path", html_dir)
@@ -122,7 +122,7 @@ class TestCORSAndSecurityHeaders:
handler._send_error(404, "Not found")
header_dict = dict(response_headers)
assert header_dict.get("Access-Control-Allow-Origin") == "*"
assert "Access-Control-Allow-Origin" not in header_dict
assert header_dict.get("X-Content-Type-Options") == "nosniff"