-
Notifications
You must be signed in to change notification settings - Fork 280
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
ignore alternative authorization header prefixes #4904
base: dev
Are you sure you want to change the base?
Conversation
Co-authored-by: Gary Pennington <garypen@gmail.com>
CI performance tests
|
@@ -139,7 +139,7 @@ The default value is `Authorization`. | |||
|
|||
The string that will always precede the JWT in the header value corresponding to [`header_name`](#header_name). This value must not include whitespace. | |||
|
|||
The default value is `Bearer`. | |||
The default value is `Bearer`. If the router encounters authorization headers with a different prefix, it will ignore them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current default does the opposite, no? It will reject the request as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, so it will be different from the current default. I don't want to add yet another option to keep a behaviour that did not make much sense. Do you think there are users that relied on checking the authorization header prefix instead of using the require_authentication
option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I would guess they may use it as an expected behavior to fail if it isn't formatted correctly, including overall header structure. I can reach out to other SAs to get a gut check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the change in behaviour is ok as long as the docs make the change clear.
@@ -0,0 +1,17 @@ | |||
### Ignore other auth prefixes in the JWT plugin | |||
|
|||
If the router encounters an authorization header with a different prefix in the value than what it expects, it will now ignore it. If the router was configured without the `require_authentication` option or without the authorization directives, then some requests that came with a different header prefix that were rejected before will now go through the router. If those options were configured, then there will be no change in behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attempted clarification, but make sure it still makes sense.
If the router encounters an authorization header with a different prefix in the value than what it expects, it will now ignore it. If the router was configured without the `require_authentication` option or without the authorization directives, then some requests that came with a different header prefix that were rejected before will now go through the router. If those options were configured, then there will be no change in behaviour. | |
If the router encounters an authorization header with a different prefix to the configured value, it will now ignore it. | |
If the router is configured without the `require_authentication` option or without the authorization directives, then requests that have a different header prefix, that were previously rejected, will now go through the router. | |
If both of those options were configured, then there will be no change in behaviour. |
|
||
If the router encounters an authorization header with a different prefix in the value than what it expects, it will now ignore it. If the router was configured without the `require_authentication` option or without the authorization directives, then some requests that came with a different header prefix that were rejected before will now go through the router. If those options were configured, then there will be no change in behaviour. | ||
|
||
As an example, with a router configure like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an example, with a router configure like this: | |
As an example, with a router configured like this: |
header_value_prefix: "Bearer" | ||
``` | ||
|
||
In the above, the router will ignore `Authorization: Basic <token>`, but process requests with `Authorization: Bearer <token>` defined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the above, the router will ignore `Authorization: Basic <token>`, but process requests with `Authorization: Bearer <token>` defined. | |
In the above, the router will ignore requests with a `Authorization: Basic <token>` header and process requests with a `Authorization: Bearer <token>` header. |
Follow up to #4718
This PR enables the JWT plugin to ignore other auth prefixes other than the one defined in the configuration.
This enables multiple Authorization schemes to be supported, although other schemes would need to be handled in either Rhai or a coprocessor to be used with the AuthN plugin.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩