Skip to content

QA: harden Control Center trust UI#45

Merged
00PrabalK00 merged 2 commits into
mainfrom
qa/control-center-trust-ui
May 31, 2026
Merged

QA: harden Control Center trust UI#45
00PrabalK00 merged 2 commits into
mainfrom
qa/control-center-trust-ui

Conversation

@00PrabalK00
Copy link
Copy Markdown
Owner

Scope

Surgical QA of the v0.9.0 Control Center trust layer only: ControlCenter methods (flight_records, flight_record, timeline, worktree_board, context_packets, roi, _worktree_schedules), the read-only /api/* endpoints, and the app.js trust views (timelineView, worktreeBoardView, laneCard, flightRecordView, roiView, contextPacketView, bindFlightRecords, bindContextPackets).

Defects found

XSS — none exploitable (rendering already safe)

Audited every interpolation in the trust views. All user/task-controlled strings (task title/objective, agent, branch, lane role, file/owned paths, schedule objective, lane name) are already wrapped in escapeHtml(...). The only unescaped interpolations were the data-task attribute values, which today hold strictly server-generated T%04d ids (not user-controllable), so there was no live XSS hole.

Hardened anyway (defense-in-depth): data-task in flightRecordView, contextPacketView, and taskTable now go through escapeHtml. These values are read back via dataset.task into API/inspect calls, so escaping prevents attribute breakout should id formats ever change.

Robustness — confirmed solid

  • Empty store (no db_file, no tasks): all trust endpoints return HTTP 200 with sane empty JSON — verified no 500/traceback.
  • /api/flight-record?task=BOGUS raises ValueError/FlightRecordError, both caught by the handler and returned as a clean 400 JSON error.
  • context_packets already has a broad except that degrades to empty/None fields when intel functions raise.
  • Trust endpoints are GET/read-only and not gated by the POST mutation token; mutations still require it.

Tests added (+9, all green)

tests/test_control_center.py:

  1. test_trust_endpoints_on_empty_store_return_200_and_sane_json
  2. test_flight_record_with_bogus_task_returns_clean_400 (BOGUS / T9999 / empty)
  3. test_timeline_and_board_with_standalone_worktree_only
  4. test_timeline_and_board_with_scheduled_lanes
  5. test_timeline_and_board_empty_when_nothing_scheduled
  6. test_context_packets_degrade_when_intel_raises (monkeypatches score_intel/gather_context_intel)
  7. test_trust_endpoints_are_get_readable_without_token (+ mutation still 403)
  8. test_trust_endpoints_preserve_malicious_strings_verbatim_for_ui_escaping
  9. test_app_js_escapes_user_controlled_trust_values (static XSS guard: asserts every trust-view interpolation is escapeHtml-wrapped and forbids known-unsafe patterns)

Verification

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null python -m unittest discover -s tests295 tests OK. Git-backed tests persist identity in setUp; HTTP servers bind 127.0.0.1:0 and shut down in finally.

🤖 Generated with Claude Code

00PrabalK00 and others added 2 commits May 31, 2026 23:45
Harden and verify the v0.9.0 Control Center trust layer (flight records,
timeline, worktree board, context packets, ROI).

UI defense-in-depth (continuum/ui/app.js):
- Escape the data-task attribute values in the trust views (flightRecordView,
  contextPacketView) and taskTable. These hold server-generated T%04d ids today,
  but are read back via dataset.task into API/inspect calls; escaping prevents
  attribute breakout if id formats ever change.

Tests (tests/test_control_center.py, +9):
- Empty store: all trust endpoints return HTTP 200 + sane JSON (never 500).
- /api/flight-record?task=BOGUS|T9999|"" returns a clean 400 JSON error.
- timeline/board with scheduled lanes vs standalone worktree vs nothing.
- context_packets degrades gracefully when score_intel/gather_context_intel raise.
- trust endpoints are GET-readable without the token; mutations still require it.
- XSS: API returns user-controlled strings verbatim; static assertions confirm
  every user/task-controlled value in the trust views is wrapped in escapeHtml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@00PrabalK00 00PrabalK00 merged commit a507ebf into main May 31, 2026
12 checks passed
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