deny proxy users whose role can't be resolved instead of falling back to viewer

Proxy role resolution fell back to viewer, which grants every camera, in several accidental cases. A default_role that was misspelled, null, or named a deleted role became viewer. A role_map group whose mapped role had been deleted (for example, emptied by a camera delete) got the default role. Direct role headers were lowercased but compared to case-sensitive role names, so a custom role like Garage never matched, and a custom role named Admin resolved to the built-in admin.

- match header values, default_role and role_map roles against configured roles regardless of case
- deny when default_role or a matched role_map role doesn't exist, and warn at config load for an unknown default_role
- reserve admin and viewer in every casing and reject role names that differ only by case, in config validation and the Create Role dialog
- show a null default_role as none in the settings widget
This commit is contained in:
Josh Hawkins
2026-11-23 09:34:33 -06:00
parent 3bca9b8676
commit 47fcb90893
8 changed files with 91 additions and 27 deletions
@@ -102,7 +102,7 @@ proxy:
# Optional: Auth secret that is checked against the X-Proxy-Secret header sent from
# the proxy. If not set, all requests are trusted regardless of origin.
auth_secret: None
# Optional: The default role to use for proxy auth. Must be "admin" or "viewer"
# Optional: The default role to use for proxy auth. Must be "admin", "viewer", a custom role, or "none" to deny
default_role: viewer
# Optional: The character used to separate multiple values in the proxy headers. (default: shown below)
separator: ","
+4 -1
View File
@@ -234,6 +234,8 @@ proxy:
Setting `default_role` to `none` denies access instead of falling back to a role. Any proxy-authenticated user whose headers do not match an explicit `role_map` entry receives a 403 response. This is useful when the upstream proxy authenticates a broader set of users than should reach Frigate, so that only mapped groups are allowed in.
A `default_role` that does not name a configured role is treated as `none`.
```yaml
proxy:
...
@@ -266,7 +268,8 @@ In this example:
- If the proxy passes a role header containing `camera-viewer`, the user is assigned the `viewer` role.
- If the proxy passes a role header containing `operators`, the user is assigned the `operator` custom role.
- If no mapping matches, Frigate falls back to `default_role` if configured, or denies access if `default_role` is `none`.
- If `role_map` is not defined, Frigate assumes the role header directly contains `admin`, `viewer`, or a custom role name.
- If a group matches but its mapped role no longer exists (for example, a deleted custom role), access is denied.
- If `role_map` is not defined, Frigate assumes the role header directly contains `admin`, `viewer`, or a custom role name, matched without regard to case.
**Note on matching semantics:**