Commit graph

2 commits

Author SHA1 Message Date
Brad Groux
774673b80a fix(security): RF-002 — path traversal, admin authz, agent status WebSocket
SEC-001: Path traversal prevention
- Add validatePathSegment() and ensureWithinBase() to server/src/utils/sanitize.ts
- Apply to chat-service (sessionId/taskId in file paths)
- Apply to conflict-service (filePath in path.join)
- Apply to clawdbot-agent-service (taskId/attemptId in log/request paths)

SEC-007: Admin authorization on mutating endpoints
- settings.ts: PATCH /features requires authorize('admin')
- config.ts: POST/PATCH/DELETE repos, PUT agents, PUT default-agent
- activity.ts: DELETE / requires authorize('admin')
- notifications.ts: POST/mark-sent/check require authorize('admin','agent'), DELETE requires admin
- status-history.ts: DELETE / requires authorize('admin')
- Updated test harnesses with admin auth injection

Agent Status Indicator: WebSocket fix
- BoardSidebar now uses useRealtimeAgentStatus (WebSocket) instead of useGlobalAgentStatus (polling)
- Fixed field name mismatch: server broadcasts 'activeAgents' but hook expected 'subAgents'
- Hook now correctly reads activeAgents from both WebSocket messages and REST fallback
- Added connection status indicator and stale detection to sidebar
- Fixed agent-status.ts spread order for persisted status restore

Pre-existing fixes included (from earlier RF-002 sub-agent diffs):
- auth.ts: X-Forwarded-For only trusted when trust proxy configured
- rate-limit.ts: isLocalhost returns false in production
- telemetry-service: CSV formula injection prefix sanitization
- Frontend: window.open noopener/noreferrer on all instances
2026-02-02 09:09:15 -06:00
Brad Groux
238433b2ad feat: RF-002 cross-model code audit — full codebase
Complete cross-model audit of Veritas Kanban codebase:
- Auditor: GPT-5.2 Codex (8 parallel batches)
- Reviewer: Claude Opus 4.5

Results: 331 files, 55,300 lines audited
- 39 confirmed findings (91% Codex accuracy)
- 4 High, 16 Medium, 19 Low, 0 Critical
- Top patterns: path traversal (4), race conditions (8), state bugs (12)
- Estimated remediation: 16 hours across 4 sprints

Reports: 9 batch reports + executive summary + HTML presentation
All mirrored to Brain (dm-bg/refactoring/)
2026-02-02 05:39:01 -06:00