Tighten media and review access (#25083)

* deny admin-only media to viewer

The media auth check allowed any role without a camera list before it looked at admin-only paths, so viewer could list and download the face library, classification train and dataset images, and GenAI request frames from /clips/ even though the matching API routes and UI pages are admin-only. Admin-only paths are now denied to every non-admin role before that check.

* admin-only frigate+ frame upload

the UI already hides this so this is just to fix the endpoint

* scope review lookup by event id to allowed cameras

The review lookup by event id matched the id with GLOB, so wildcard characters in the id matched other ids, and the camera check ran on whichever row matched first, returning a 403 that named a camera the user can't access. The id now matches literally and the query only searches the user's allowed cameras, so a review item on another camera returns the same 404 as a missing one.

* fix test
This commit is contained in:
Josh Hawkins
2026-11-25 05:07:34 -07:00
committed by GitHub
parent 08dcb63a9b
commit ba5b52ec47
6 changed files with 68 additions and 13 deletions
+6 -8
View File
@@ -2311,8 +2311,8 @@ paths:
$ref: '#/components/schemas/HTTPValidationError'
security:
- frigateUserAuth: []
x-required-role: camera
description: '**Access:** Authenticated user with access to the referenced camera.'
x-required-role: any
description: '**Access:** Any authenticated user.'
/review/{review_id}:
get:
tags:
@@ -6075,9 +6075,7 @@ paths:
in: path
required: true
schema:
anyOf:
- type: string
- type: 'null'
type: string
title: Camera Name
- name: frame_time
in: path
@@ -6098,9 +6096,9 @@ paths:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- frigateUserAuth: []
x-required-role: camera
description: '**Access:** Authenticated user with access to the referenced camera.'
- frigateAdminAuth: []
x-required-role: admin
description: '**Access:** Admin role required.'
/{camera_name}/start/{start_ts}/end/{end_ts}/clip.mp4:
get:
tags: