-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add write permissions check for DELETE and DROP MEASUREMENT (#23219
) We previously allowed read tokens access to all of v1 query, including InfluxQL queries that made state changes to the DB, specifically, 'DELETE' and 'DROP MEASUREMENT'. This allowed tokens with only read permissions to delete points via the legacy /query endpoint. /api/v2/query was unaffected. This adjusts the behavior to verify that the token has write permissions when specifying 'DELETE' and 'DROP MEASUREMENT' InfluxQL queries. We follow the same pattern as other existing v1 failure scenarios and instead of failing hard with 401, we use ectx.Send() to send an error to the user (with 200 status): {"results":[{"statement_id":0,"error":"insufficient permissions"}]} Returning in this manner is consistent with Cloud 2, which also returns 200 with "insufficient permissions" for these two InfluxQL queries. To facilitate authorization unit tests, we add MustNewPermission() to testing/util.go. Closes: #22799
- Loading branch information
Showing
3 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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