influxdata / influxdata/influx-cli

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

Open
#508 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

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

Start at the Go CLI handling for the influx bucket update command and its retention duration conversion; compare its behavior with validation at the REST endpoint. Reproduce the 999999w input with HTTP debug output, then verify that out-of-bounds durations are rejected before a signed overflow can produce a confusing server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.