Authentication mechanism is not compliant with HTTP grammar #12216
josegomezr
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
By complete random chance I was going over grep.app looking for real-world examples of authorization headers and stumbled upon this repo
Didn't want to open a full issue as it's not really critical, is rather a rigor thing, but would like to lay down the observations and see what y'all think.
This is the odd example I found:
payload/docs/authentication/api-keys.mdx
Lines 51 to 65 in 034a267
The documentation says that the authorization header value must match:
However RFC 9110 (what I believe to be the current normative RFC for HTTP semantics) defines the Authorization header as follows (Took the liberty to collect all the relevant ABNF grammar):
The header value
foo API-Key bar
can't be matched againstcredentials
, thetoken68
alternative does not allow anything afterwards, is an stop condition.At best it could fit the syntax if we ignore the last invalid token and interpret it as:
But that'd lose the API key which is effectively useless to authenticate.
In order to be HTTP Compliant the header value I think the easiest is to use the
auth-param
syntax, this also would align with the recommendation on § 16.4.2Maybe something along the lines of:
However that'd be a breaking change, in case being compliant is a desire, a different auth scheme name would make things easier to interop:
In case it's desired to be compliant, the suggestions above can pave the way to it, and also provide extensibility for future features in authentication :)
That was my ted talk ™️ /s
Beta Was this translation helpful? Give feedback.
All reactions