Authorization header scheme is not case sensitive #6568
Labels
good first issue
A well-defined bug or improvement with sufficient context which should be approachable for new contr
type/bug
Feature does not function as expected
Overview of the Issue
The HTTP
Authorization
header is defined in RFC-7235 as:The RFC text explicitly states that the
auth-scheme
token is to be treated as a case-insensitive token.The
parseTokenInternal
function does a case sensitive comparison.consul/agent/http.go
Lines 885 to 886 in 76cf540
Reproduction Steps
Steps to reproduce this issue, eg:
--header 'Authorization: bearer <token>
replacing<token>
with the real token, the request should fail with an authorization failure--header 'Authorization: Bearer <token>
replacing<token>
with the real token, the request should succeedConsul info for both Client and Server
Client info
Server info
Operating system and Environment details
Server is a unclustered docker container running consul:1.6
Log Fragments
I don't have the log-level turned up currently, so the consul server logs are scant. I can probably provide more detailed logs later on tonight if required.
The client is a hand-rolled HTTP python client so the logs are custom:
The bearer token is shown using python's
repr
syntax on the fifth line so the single-quotes indicate that it is a string and ARE NOT included in the header. If I change thebearer
toBearer
, then it works like a charm.The text was updated successfully, but these errors were encountered: