Skip to content

fix(camera): restrict proxy to admins and add stream timeouts#41

Open
Micsi wants to merge 1 commit into
mainfrom
codex/propose-fix-for-authenticated-ssrf-vulnerability
Open

fix(camera): restrict proxy to admins and add stream timeouts#41
Micsi wants to merge 1 commit into
mainfrom
codex/propose-fix-for-authenticated-ssrf-vulnerability

Conversation

@Micsi
Copy link
Copy Markdown
Owner

@Micsi Micsi commented May 17, 2026

Motivation

  • Close an authenticated SSRF/abuse vector exposed by the camera proxy by limiting who can invoke it.
  • Reduce availability/exhaustion risk from unbounded upstream streams by enforcing finite HTTP client timeouts.

Description

  • Add a database dependency (Database, get_db) and perform an is_admin lookup inside the camera-specific auth dependency to require admin privileges for /api/v1/camera/proxy.
  • Preserve existing JWT entry points (Authorization: Bearer … header and ?_token=… query) for camera widgets while decoding the token and enforcing the admin check.
  • Replace the unbounded streaming client timeout (timeout=None) with a finite httpx.Timeout(connect=5.0, read=30.0, write=10.0, pool=30.0) for the GET stream.
  • Keep the existing URL scheme check, DNS-based IP denylist (_check_ssrf), and follow_redirects=False behavior to prevent redirect-based SSRF.

Testing

  • Ran python -m compileall obs/api/v1/camera.py, which completed successfully and indicates the module has no syntax errors.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant