Skip to content

Harden SSRF defenses and admin auth for safe shared deploys - #1

Closed
pandeyvishwas51-oss wants to merge 1 commit into
mainfrom
fix/ssrf-admin-auth-hardening
Closed

Harden SSRF defenses and admin auth for safe shared deploys#1
pandeyvishwas51-oss wants to merge 1 commit into
mainfrom
fix/ssrf-admin-auth-hardening

Conversation

@pandeyvishwas51-oss

Copy link
Copy Markdown
Member

Summary

  • SSRF (critical): Probe targets can no longer point at loopback, RFC1918, link-local, or cloud metadata (169.254.169.254). Validation runs at admin registration, scheduler dispatch, and probe execution (defense in depth), and URL host must match the registered domain.
  • Admin auth gaps (high): All /admin/* routes now go through require_admin() with constant-time key compare. Missing ADMIN_API_KEY can fail closed via ALLOW_UNAUTHENTICATED_ADMIN=false (recommended for prod).
  • Flow fixes: /ready returns 503 when DB/Redis are down (K8s-ready); CORS no longer pairs * with credentials; probe-node listing uses Redis SCAN instead of blocking KEYS.

See docs/SECURITY.md for the full threat model and recommended settings.

Why this matters for users

Without these guards, anyone who could hit an open admin API (default when ADMIN_API_KEY is empty) could register http://169.254.169.254/... or http://127.0.0.1:... and force the Playwright fleet to scrape internal services / cloud IMDS.

Test plan

  • pytest tests/ -v --ignore=tests/integration61 passed
  • SSRF unit matrix: localhost, private IPs, IMDS, file://, DNS-rebinding mock
  • Admin API: reject SSRF target, reject domain/URL mismatch, 401 with bad key, 503 when unauth admin disallowed
  • Probe executor refuses http://127.0.0.1/ even if a bad Redis job is injected
  • Manual: set ADMIN_API_KEY=test + ALLOW_UNAUTHENTICATED_ADMIN=false, confirm /api/v1/admin/targets requires header
  • Manual: POST /admin/targets with url=http://127.0.0.1/ → 400
  • Manual: with Postgres+Redis up, /ready → 200; stop Redis → 503

Made with Cursor

Block private/metadata probe targets at registration, dispatch, and
execution; require admin auth on all /admin routes; fix readiness 503
and unsafe CORS defaults so shared deploys fail closed safely.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pandeyvishwas51-oss

Copy link
Copy Markdown
Member Author

Closing — will reopen from the correct account (arpita-at) after local review.

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