Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x Compatibility API doesn't set WWW-Authentication header #24219

Open
handymenny opened this issue Apr 26, 2023 · 0 comments
Open

1.x Compatibility API doesn't set WWW-Authentication header #24219

handymenny opened this issue Apr 26, 2023 · 0 comments

Comments

@handymenny
Copy link

handymenny commented Apr 26, 2023

Steps to reproduce:

  1. Send a request to /write without including any Authorization header
  2. Check if response contains header Www-Authenticate with value Basic 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: 85f725f) build_date: 2023-04-05T15:32:18Z
  • Container: Docker version 23.0.4, build f480fb1
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
influxdb 2.x has a compatibility v1 api that don't set the "WWW-Authenticate" header (violating rfc7235)
Setting the authorization header manually workarounds this issue

See: influxdata/influxdb#24219
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
influxdb 2.x has a compatibility v1 api that don't set the "WWW-Authenticate" header (violating rfc7235)
Setting the authorization header manually workarounds this issue

See: influxdata/influxdb#24219
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
influxdb 2.x has a compatibility v1 api that don't set the "WWW-Authenticate" header (violating rfc7235)
Setting the authorization header manually workarounds this issue

See: influxdata/influxdb#24219
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
influxdb 2.x has a compatibility v1 api that don't set the "WWW-Authenticate" header (violating rfc7235)
Setting the authorization header manually workarounds this issue

See: influxdata/influxdb#24219
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
influxdb 2.x has a compatibility v1 api that don't set the "WWW-Authenticate" header (violating rfc7235)
Setting the authorization header manually workarounds this issue

See: influxdata/influxdb#24219
handymenny added a commit to handymenny/SmokePing that referenced this issue Apr 27, 2023
InfluxDB 2.x v1 (compatibility) api doesn't set the "WWW-Authenticate" header (violating rfc7235).

Work around this issue by manually setting the Authorization header.

See: influxdata/influxdb#24219
oetiker pushed a commit to oetiker/SmokePing that referenced this issue Jun 14, 2023
* influxdb authentication: set authorization header manually

InfluxDB 2.x v1 (compatibility) api doesn't set the "WWW-Authenticate" header (violating rfc7235).

Work around this issue by manually setting the Authorization header.

See: influxdata/influxdb#24219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant