pyronear / pyronear/pyro-api

Tighten role-based access control and expose a permissions endpoint

Open
#581 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
29
Forks
14
Avg merge
9d 1h
Merged PRs (30d)
5

Description

Some sensitive endpoints (alert acknowledgement, camera live stream) need clearer role gating so that USER accounts cannot perform
agent/admin-only actions. The platform also needs a reliable way to know, ahead of time, whether the current user can perform a given
action.

Goals

  • Enforce role checks on sensitive actions and ensure USER is blocked on:
    • Alert acknowledgement (sequence labeling, sequence unmatch)
    • Camera live stream access
  • Return a clean, machine-readable error payload when access is denied, so the platform can display a proper message to the end user
    (e.g. consistent detail + an error code like forbidden_role).
  • Add a GET /users/me/permissions (or equivalent) endpoint that returns, for the authenticated user, which actions they are allowed to
    perform (e.g. can_acknowledge_alert, can_access_live_stream, can_label_sequence, …). The frontend should rely on this rather than
    hardcoding role logic.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the alert acknowledgement, sequence labeling/unmatching, and camera live-stream entry points, then trace the existing role checks and denied-response conventions. Review how authenticated-user endpoints are organized before implementing the permissions response; done means USER accounts are blocked with a consistent forbidden_role payload and GET /users/me/permissions reports the relevant allowed actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, authentication, authorization, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.