-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
No API key found in headers or querystring #2013
Comments
I was about to report the same issue. I think it's just the documentation. On https://getkong.org/docs/0.9.x/getting-started/enabling-plugins/ it says "Since you did not specify the required apikey header or parameter, the response should be 403 Forbidden" In reality following all steps in the setup the response is a "403 Forbidden" with the content Of course when I call the key-auth enabled API with In my opinion returning 401 vs 403 is good, especially for API-users to give them a hint they forgot to send the key. Again, I think the documentation just needs to be updated. |
hi @mtmail , That is not the issue. The issue is the key name. If the key name is AUTH-KEY, then the subsequent call upstream works. But with underscore, it does not. |
might be openresty issue see last paragraph of https://github.com/openresty/lua-nginx-module#ngxreqget_headers Not sure though what the status of allowed characters is in headers. |
I believe there is an |
Either way, it does not return the correct response. If kong does not support underscore in the key name, then the request to enable api key plugin should have failed with a meaningful error message and this outlined in the api documentation also. |
@shavo007 Contributions welcome! |
@thibaultcha i hear you! but i think mashape and the team needs to define a process in place first to consider:
To me documentation is source of truth. If this is not up to date, you will have big problems! Again, this is my opinion from my recent analysis of kong. Take it as you will! |
This is more of an unexpected side-effect/bug rather than an overlook over the documentation. Contributors are encouraged to propose sister PRs for changes introduced in this repository. You are welcome to defend your opinion/use case, and propose changes over those 2 topics:
|
it depends how you want to proceed. from the comments sounds like you have two choices: 1)state in api documentation, that api key name does not allow special characters such as underscore. return a 400 bad request if a user attempts to create api key plugin with incorrect value
is that correct? |
fixes #2013 adds validation of header names (was completely absent) due to nginx/openresty config the '_' is also considered an invalid character.
Closing this, fix is in #2142 |
good work @Tieske. Can you please add milestone label to the issue so I can keep track? Thanks, |
Adds validation of header names (was completely absent) due to nginx/openresty config the '_' is also considered an invalid character. Fix #2013 Signed-off-by: Thibault Charbonnier <[email protected]>
It seem the bug is still in 0.10.1?I hit the bug in the kong v0.10.1 |
@workcheng How did you hit it? |
Summary
Verifying credentials, I get invalid response back from Kong.
Also should the responses not comply with json api spec?
Steps To Reproduce
http://localhost:8001/apis/locations/plugins
{ "name": "key-auth", "config.key_names": "AUTH_KEY" }
http://localhost:8000/
Headers:
Host: blah
AUTH_KEY: xyz
{ "message": "No API key found in headers or querystring" }
Additional Details & Logs
The text was updated successfully, but these errors were encountered: