pyro-api icon indicating copy to clipboard operation
pyro-api copied to clipboard

Add ip_address and livestream_activated columns in camera table

Open RonanMorgan opened this issue 4 months ago • 5 comments

This has been done to avoid the usage of a .json configuration file with the plateforme

@MateoLostanlen I didn't implement a new endpoint yet, maybe the get_camera endpoint would be enough ? But this means you have to manager the "rights" yourself since the endpoint is available for UserRole.ADMIN, UserRole.AGENT, UserRole.USER

  1. If we consider the "ip_adress" very sensible I can : => create a new endpoint which return only the ip_adress => don't return the ip_address in the get_camera endpoint

  2. While we are on it we should check all the information needed in the configuration.json file of the engine and add them in the camera table

what do you think ?

RonanMorgan avatar Aug 28 '25 12:08 RonanMorgan

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 84.34%. Comparing base (3cf6e39) to head (7bccb9b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
+ Coverage   84.02%   84.34%   +0.32%     
==========================================
  Files          39       39              
  Lines        1208     1233      +25     
==========================================
+ Hits         1015     1040      +25     
  Misses        193      193              
Flag Coverage Δ
backend 83.70% <100.00%> (+0.36%) :arrow_up:
client 93.67% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Aug 28 '25 12:08 codecov[bot]

Thanks for the PR :) I may be late to the party again, so pardon the questions: why do we need the IP address in the DB? We ssh via a VPN so we can't use it, right? And any HTTP request from the camera to the backend will reveal the IP

frgfm avatar Aug 29 '25 10:08 frgfm

Hi @frgfm , sorry, a bit of context. With the arrival of livestream (remote camera control), the system now works as follows

To make this work, we need to know the IP of each Pi (on the VPN) in order to send commands At the moment this information is stored in a JSON file on the VM, but we agree it would be cleaner to have it in the API

MateoLostanlen avatar Sep 04 '25 07:09 MateoLostanlen

@RonanMorgan, I think the IP is not really sensitive information. It’s kind of a local IP, so without VPN access there’s nothing that can be done with it

However, what’s missing here is a route to get a user’s role in order to know whether they have the right to stream or not (admin, agent): ok user (not ok). So let's create get_role

MateoLostanlen avatar Sep 04 '25 07:09 MateoLostanlen

Thanks for the precision!

I understand this, but can't this be a good VPN/alias setup instead? Static IPs seem a bit unstable or at best not very secure (we need to encrypt them otherwise if the database gets stolen, we'll get DDoS at vitam eternam 😅 )

frgfm avatar Sep 26 '25 11:09 frgfm