Check read permissions for regressor sensors when triggering forecasts#2096
Draft
Check read permissions for regressor sensors when triggering forecasts#2096
Conversation
Documentation build overview
Show files changed (1 files in total): 📝 1 modified | ➕ 0 added | ➖ 0 deleted
|
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/9b3ff676-cf08-4d79-8cd1-657ef1581d40 Co-authored-by: BelhsanHmida <149331360+BelhsanHmida@users.noreply.github.com>
…mplify asset type name Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/9b3ff676-cf08-4d79-8cd1-657ef1581d40 Co-authored-by: BelhsanHmida <149331360+BelhsanHmida@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Check read permissions for regressors when triggering forecasts
Check read permissions for regressor sensors when triggering forecasts
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
POST /<sensor>/forecasts/triggerendpoint checkedcreate-childrenpermissions for the target sensor but silently skippedreadpermission checks for regressor sensors (future-regressors,past-regressors,regressorsinconfig), allowing users to reference sensors they shouldn't be able to see.Changes
api/v3_0/sensors.py): Intrigger_forecast, after loading the raw JSON payload and before dispatching the job, collect all regressor sensor IDs fromconfigand callcheck_access(regressor, "read")for each. The schema already guarantees these IDs resolve to existing sensors, so noNoneguard is needed — any violation raisesForbidden(403) orUnauthorized(401).api/v3_0/tests/test_forecasting_api.py): Addedtest_trigger_forecast_with_unreadable_regressor_returns_403, parametrized over all three regressor fields. Creates a target sensor on the requesting user's account (hascreate-children) and a regressor sensor on a different account (noreadaccess), asserts 403.