influxdb/v1/coordinator
Jamie Strandboge e304ef9764
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
2022-03-24 07:28:38 -05:00
..
config.go feat: add `--storage-write-timeout` flag to set write request timeouts (#22617) 2021-10-04 15:38:09 -04:00
meta_client.go chore(tsdb): Initial commit of tsdb package 2020-08-03 09:17:23 -07:00
meta_client_test.go chore(tsdb): Initial commit of tsdb package 2020-08-03 09:17:23 -07:00
points_writer.go feat: point write requests have metrics (#22910) 2021-11-22 12:58:17 -05:00
points_writer_internal_test.go fix: prevent silently dropped writes with overlapping shards (#21946) 2021-07-27 12:15:08 -04:00
points_writer_test.go feat: point write requests have metrics (#22910) 2021-11-22 12:58:17 -05:00
shard_mapper.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
shard_mapper_test.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
statement_executor.go fix: add write permissions check for DELETE and DROP MEASUREMENT (#23219) 2022-03-24 07:28:38 -05:00
statement_executor_test.go fix: add write permissions check for DELETE and DROP MEASUREMENT (#23219) 2022-03-24 07:28:38 -05:00