Skip to content

fix(dashboard): require loopback Host and JSON Content-Type on control plane - #11

Open
SashaMIT wants to merge 1 commit into
AMAP-ML:mainfrom
SashaMIT:fix/dashboard-host-and-csrf
Open

fix(dashboard): require loopback Host and JSON Content-Type on control plane#11
SashaMIT wants to merge 1 commit into
AMAP-ML:mainfrom
SashaMIT:fix/dashboard-host-and-csrf

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 8, 2026

Copy link
Copy Markdown

Summary

  • The dashboard is an unauthenticated loopback control plane: any caller that can reach the port can resolve approvals, inject operator instructions, or switch the browsed run.
  • Host allowlist: reject requests whose Host header is not loopback (or the configured bind host). A DNS-rebinding page that reaches the TCP port with Host: evil.example can no longer read /api/state or drive the agent.
  • JSON Content-Type on every POST: require application/json (optional charset=… ok) for /api/inject, /api/approvals/.../resolve, and /api/select-run. Cross-origin text/plain form posts become preflighted, which this server never answers.
  • Cap POST bodies at 256 KiB and add tests/test_dashboard_server.py covering both gates.

This supersedes #6 (Content-Type only on two routes; no Host check; claimed charset/select-run coverage was incomplete).

Test plan

  • PYTHONPATH=src python3 -m unittest tests.test_dashboard_server -v (11 tests)
  • Local Amber repro: Host: evil.example + Content-Type: application/json inject/resolve → 403; loopback Host + JSON → 200; text/plain on inject/select-run → 415

Made with Cursor

…l plane

The dashboard is an unauthenticated loopback control plane. Without a Host
allowlist, a DNS-rebinding page that reaches the TCP port can still call the
API with application/json. Without a JSON Content-Type gate on every POST,
cross-origin text/plain forms can inject instructions, resolve approvals, or
switch the browsed run. Cap POST bodies and cover both gates with unit tests.
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