influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
61 stars 22 forks source link

Unvalidated duration input leads to signed integer overflow and confusing error message #508

Open reidkaufmann opened 1 year ago

reidkaufmann commented 1 year ago

This input probably isn’t expected, but I tried it on a whim. Validating inputs is a chore and clearly the REST endpoint is doing it (as expected), but not the CLI which performs an invalid conversion which leads to a confusing response since a negative input was not provided (though it may be out of bounds).

$ influx bucket update -i a0<redacted>54 -r 999999w --http-debug
…
{"retentionRules":[{"everySeconds":-3943159232,"type":"expire"}]}
…
Error: failed to update bucket "a0<redacted>54": 422 Unprocessable Entity: expiration seconds cannot be negative

Enabling debug output seems to indicate that the unchecked input leads to an signed integer overflow.