influxdata / influxdata/influxdb

Variables - POST/PUT/PATCH CSV variable requests with value of property 'selected' not in values list is not controlled by the server

Open
#23,859 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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. create a request to POST a new or PATCH and existing CSV variable
2. for the property `selected` assign a value not in the array `agruments.values`
3. submit the request

__Expected behavior:__
There are other features which rely on the consistency of the `selected` property. For example the UI in preparing dashboards. So, a check of the consistency of a `selected` value actually being in the `argument.values` array would be expected.

__Actual behavior:__
The variable can be created or updated with an inconsistent value for the property `selected`

__example request PATCH body__
```javascript
{
selected: ['Thor'],
arguments: {
type: 'constant',
values: ['Daphne', 'Galatea', 'Thetis', 'Persephone', 'Harmonia']
}
}
```
__response body from request__
```json
{
"id": "0a3c853ece6a3000",
"orgID": "63e23d418425557b",
"name": "metamorphoses",
"description": "generic CSV description",
"selected": [
"Thor"
],
"arguments": {
"type": "constant",
"values": [
"Daphne",
"Galatea",
"Thetis",
"Persephone",
"Harmonia"
]
},
"sort_order": 0,
"createdAt": "2022-11-04T10:02:33.145865032Z",
"updatedAt": "2022-11-04T10:02:33.478904201Z",
"labels": [],
"links": {
"self": "/api/v2/variables/0a3c853ece6a3000",
"labels": "/api/v2/variables/0a3c853ece6a3000/labels",
"org": "/api/v2/orgs/63e23d418425557b"
}
}

```

__Environment info:__

Testing against K8SIDPE remocal

latest commit

```
commit e9b4a39a7a048fdbdd482d117c37e233fdeb6d41 (HEAD -> master, origin/master, origin/HEAD)
Author: Yoofi Quansah
Date: Thu Nov 3 17:22:29 2022 -0700

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name a file or test; start by locating the POST/PUT/PATCH variable request handlers for CSV variables. Reproduce the example with selected set to “Thor”, then add coverage for rejecting values absent from arguments.values and verify valid requests remain accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.