influxdata / influxdata/influxdb
/dashboards/{dashboardID}/cells POST - cell request with negative height and width values is accepted
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
1. prepare a createCell request to be sent to the endpoint `/dashboards/{dashboardID}/cells` POST
2. in the request set the properties `h` and `w` to nonsense values like `-100`
3. send the request
__Expected behavior:__
Expected that nonsensical values outside of a reasonable range would be caught. Dimension values that are negative (or well beyond the layout geometry) do not make sense and should be flagged and an error returned with a message of the type 'negative values are invalid' or 'dimension values need to be between 0 and 100'. Or the underlying integer could be 'unsigned'.
__Actual behavior:__
Server returns a new cell object with negative dimensions.
Note this also occurs with values in the `cells` property of a `PatchDashboardRequest` sent to `/dashboards/{dashboardID} PATCH`
__Environment info:__
Testing against K8S-IDPE remocal.
latest commit
```
commit c63a9166ad1973c7c730da156b51b47827e886cb (HEAD -> master, origin/master, origin/HEAD)
Author: influx-acs[bot] <107396960+influx-acs[bot]@users.noreply.github.com>
Date: Thu Dec 15 23:03:09 2022 +0000
```
Contributor guide
Research direction
Start by tracing the POST /dashboards/{dashboardID}/cells handler and the PATCH /dashboards/{dashboardID} handler, then find the request validation and existing tests for dashboard cells. Reproduce the issue with negative h and w values; done means both request forms reject invalid dimensions with an error instead of creating or updating a cell.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100