Scan progress pushed to the dashboard (server-sent events) #402

Open
opened 2026-09-25 19:36:45 +00:00 by sharang · 0 comments
Owner

Split out of #372 (2026-09-25).

Today

Findings are saved as each scanner stage ends (#401). The dashboard polls the scan runs every 5 s, and a running run's findings every 5 s (GET /api/v1/findings?scan_run_id=…, #389). Stages take seconds to minutes, so a customer sees little difference from push.

Goal

Progress events (phase changes, findings saved, skipped stages, run finished) are pushed to the dashboard as they happen. Polling stays as the fallback.

Notes

  • Model: the pentest stream (api/handlers/pentest_handlers/stream.rs, a broadcast::channel per session in agent.rs) replays stored events, then follows live ones. The same pattern fits a scan run, with events emitted from update_phase, skip_stage and RunFindings::save_new.
  • The path to check first: the browser → the dashboard (a server function or a proxied route) → the agent. The session auth and Orca's ingress must not buffer or cut a long-lived connection. Check whether Orca's proxy supports SSE (text/event-stream, no buffering, idle timeout).
  • Dashboard: nothing consumes a stream today (no EventSource). The run card and the live findings list would switch from polling to events when the stream is up.

Done when

  • A scan run's events arrive in the dashboard within a second, through the real ingress on staging.
  • A dropped stream falls back to polling without the user noticing.
  • Tenant isolation: a stream only carries the caller's tenant's runs (a negative test).
Split out of #372 (2026-09-25). ## Today Findings are saved as each scanner stage ends (#401). The dashboard polls the scan runs every 5 s, and a running run's findings every 5 s (`GET /api/v1/findings?scan_run_id=…`, #389). Stages take seconds to minutes, so a customer sees little difference from push. ## Goal Progress events (phase changes, findings saved, skipped stages, run finished) are pushed to the dashboard as they happen. Polling stays as the fallback. ## Notes - **Model:** the pentest stream (`api/handlers/pentest_handlers/stream.rs`, a `broadcast::channel` per session in `agent.rs`) replays stored events, then follows live ones. The same pattern fits a scan run, with events emitted from `update_phase`, `skip_stage` and `RunFindings::save_new`. - **The path to check first:** the browser → the dashboard (a server function or a proxied route) → the agent. The session auth and Orca's ingress must not buffer or cut a long-lived connection. Check whether Orca's proxy supports SSE (`text/event-stream`, no buffering, idle timeout). - **Dashboard:** nothing consumes a stream today (no `EventSource`). The run card and the live findings list would switch from polling to events when the stream is up. ## Done when - A scan run's events arrive in the dashboard within a second, through the real ingress on staging. - A dropped stream falls back to polling without the user noticing. - Tenant isolation: a stream only carries the caller's tenant's runs (a negative test).
sharang added the enhancement label 2026-09-25 19:36:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#402