mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-30 20:26:05 -05:00
CORSHeaders() (web UI) and AppController::beforeFilter() (API) send Access-Control-Allow-Origin with Access-Control-Allow-Credentials: true. With no Servers rows and ZM_MIN_STREAMING_PORT set they reflected any Origin, and with Servers rows they matched the Origin against each server's Hostname and Name with a regex anchored only at the start, so https://zm.example.com.evil.net was accepted for zm.example.com. Both now call corsAllowedOrigin() in Network.php, which accepts an Origin of the form scheme://host[:port] whose host equals a server's Hostname or Name, or, without Servers rows and with streaming ports, the host this request was made to. Any port is accepted, so multi-port streaming keeps working. Same-origin and unlisted origins get no CORS headers, as before; the web UI still warns about unlisted origins only when Servers rows exist. Tests: tests/php/test_cors_allowed_origin.php Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>