influxdata / influxdata/influxdb
/telegrafs POST does not verify types of properties in request body and throws HTTP 500
- 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 new telegraf request with one of the following properties of the wrong type e.g.
1. `plugins` - as an object instead of an array
2. `metadata` - as an array instead of an object matching `{ buckets: [string] }`
3. `config` - as an object instead of a string
4. `orgID` - as a number, e.g. `Math.PI`
2. send the request
__Expected behavior:__
Expected that before the received data is sent for further processing that it would be verified as being of the right type and in the case of `config` or `orgID` the right form. When this is not the case, expect HTTP 400 _invalid_ to be returned.
For example with some other resources posting an `orgID` value that is not a string returns an HTTP 400 error with the message 'invalid ID'.
__Actual behavior:__
All of the above described type violations lead to an HTTP 500 internal server error.
__Environment info:__
Testing against K8S-IDPE remocal.
Latest commit
```
commit b2b5b507378d68beaa249ee8ec495032edd82920 (HEAD -> master, origin/master, origin/HEAD)
Author: influx-acs[bot] <107396960+influx-acs[bot]@users.noreply.github.com>
Date: Sun Nov 13 09:57:57 2022 +0000
```
__Related issue__
#23904
Contributor guide
Research direction
Start by locating the POST /telegrafs handler and its request-body validation. Reproduce the listed wrong types for plugins, metadata, config, and orgID, then verify that invalid input is rejected with HTTP 400 instead of reaching processing and producing HTTP 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100