Skip to content

Wrong error message with X-ClickHouse-Quota HTTP header #59549

Closed

Description

@SoprachevAK

Wrong error message when using X-ClickHouse-Quota header with user auth via Basic or url param in HTTP interface.
May be wrong logic.

Error says about SSL, but SSL not using. Without X-ClickHouse-Quota works fine

Reproduce on recent release 24.1.2.5

Step to reproduce

  • Clickhouse 24.1.2.5
  • HTTP interface
  • Execute any of next request
curl -vvv --location 'http://localhost:8123?user=public' --header 'X-ClickHouse-Quota: test' --data 'select 1;'
curl -vvv --location 'http://localhost:8123' --header 'X-ClickHouse-Quota: test' --header 'Authorization: Basic cHVibGljOg==' --data 'select 1;'

Visible behavior

Code: 516. DB::Exception: Invalid authentication: it is not allowed to use SSL certificate authentication and Authorization HTTP header simultaneously. (AUTHENTICATION_FAILED) (version 24.1.2.5 (official build))

Expected behavior

1

Additional context

Full response

*   Trying [::1]:8123...
* Connected to localhost (::1) port 8123
> POST / HTTP/1.1
> Host: localhost:8123
> User-Agent: curl/8.4.0
> Accept: */*
> X-ClickHouse-Quota: test
> Authorization: Basic cHVibGljOg==
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
> 
< HTTP/1.1 403 Forbidden
< Date: Sun, 04 Feb 2024 03:32:14 GMT
< Connection: Keep-Alive
< Content-Type: text/plain; charset=UTF-8
< X-ClickHouse-Server-Display-Name: 52b7dc8899db
< Transfer-Encoding: chunked
< X-ClickHouse-Exception-Code: 516
< Keep-Alive: timeout=30
< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0","elapsed_ns":"87163"}
< 
Code: 516. DB::Exception: Invalid authentication: it is not allowed to use SSL certificate authentication and Authorization HTTP header simultaneously. (AUTHENTICATION_FAILED) (version 24.1.2.5 (official build))
* Connection #0 to host localhost left intact

Working variants:

Both in header or both in url params

curl -vvv --location 'http://localhost:8123' --header 'X-ClickHouse-Quota: test' --header 'X-ClickHouse-User: public' --header 'X-ClickHouse-Key: '  --data 'select 1;'
curl -vvv --location 'http://localhost:8123?user=public&quota_key=test'  --data 'select 1;'

Another strange error message

curl -vvv --location 'http://localhost:8123?quota_key=test' --header 'Authorization: Basic cHVibGljOg==' --data 'select 1;'
*   Trying [::1]:8123...
* Connected to localhost (::1) port 8123
> POST /?quota_key=test HTTP/1.1
> Host: localhost:8123
> User-Agent: curl/8.4.0
> Accept: */*
> Authorization: Basic cHVibGljOg==
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
> 
< HTTP/1.1 403 Forbidden
< Date: Sun, 04 Feb 2024 03:43:50 GMT
< Connection: Keep-Alive
< Content-Type: text/plain; charset=UTF-8
< X-ClickHouse-Server-Display-Name: 52b7dc8899db
< Transfer-Encoding: chunked
< X-ClickHouse-Exception-Code: 516
< Keep-Alive: timeout=30
< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0","elapsed_ns":"47400"}
< 
Code: 516. DB::Exception: Invalid authentication: it is not allowed to use Authorization HTTP header and authentication via parameters simultaneously. (AUTHENTICATION_FAILED) (version 24.1.2.5 (official build))
* Connection #0 to host localhost left intact

Activity

  1. added
    potential bug
    on Feb 4, 2024
  2. added
    bug
    and removed
    potential bug
    on Apr 9, 2024
  3. added a commit that references this issue on Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions