influxdata / influxdata/influxdb
1.x Compatibility API doesn't set WWW-Authentication header
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:
- Send a request to /write without including any Authorization header
- Check if response contains header
Www-Authenticatewith valueBasic realm="InfluxDB"
Expected behavior:
Www-Authenticate set in the response, like InfluxDB 1.x does:
$ curl -X POST -v 127.0.0.1:8086/write?db=smokeping
* Trying 127.0.0.1:8086...
* Connected to 127.0.0.1 (127.0.0.1) port 8086 (#0)
> POST /write?db=smokeping HTTP/1.1
> Host: 127.0.0.1:8086
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Content-Type: application/json
< Request-Id: df680867-e425-11ed-8009-0242ac140002
< Www-Authenticate: Basic realm="InfluxDB"
< X-Influxdb-Build: OSS
< X-Influxdb-Version: 1.8.1
< X-Request-Id: df680867-e425-11ed-8009-0242ac140002
< Date: Wed, 26 Apr 2023 11:31:23 GMT
< Content-Length: 55
<
{"error":"unable to parse authentication credentials"}
* Connection #0 to host 127.0.0.1 left intact
Actual behavior:
Www-Authenticate isn't included in the response:
curl -X POST -v 127.0.0.1:8086/write?db=smokeping
* Trying 127.0.0.1:8086...
* Connected to 127.0.0.1 (127.0.0.1) port 8086 (#0)
> POST /write?db=smokeping HTTP/1.1
> Host: 127.0.0.1:8086
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=utf-8
< X-Influxdb-Build: OSS
< X-Influxdb-Version: v2.7.0
< X-Platform-Error-Code: unauthorized
< Date: Wed, 26 Apr 2023 11:34:21 GMT
< Content-Length: 55
<
* Connection #0 to host 127.0.0.1 left intact
{"code":"unauthorized","message":"unauthorized access"}
This behavior breaks compatibility with clients that send the Authorization header only after receiving a 401 response with the Www-Authenticate header, such as SmokePing
Environment info:
- System info: Linux 6.1.21-v8+ aarch64
- InfluxDB version: InfluxDB v2.7.0 (git: 85f725f8b9) build_date: 2023-04-05T15:32:18Z
- Container: Docker version 23.0.4, build f480fb1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the unauthenticated POST request to the /write compatibility API endpoint and inspect how its 401 response is produced. Trace that endpoint's authentication failure path and verify that the response includes Www-Authenticate: Basic realm="InfluxDB", matching the expected compatibility behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100