envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
25.1k stars 4.82k forks source link

API Key auth #34877

Open zhaohuabing opened 5 months ago

zhaohuabing commented 5 months ago

Title: API Key auth

Description: An HTTP filter to support API Key auth. The API key authentication filter can be used to authorize HTTP requests using the provided API key in the request. API keys are a simple and widely used method in web services to ensure that only authorized applications and users can interact with the API. It would be beneficial if Envoy could support this feature.

An API key is a token that a client provides when making API calls. The key can be sent in the query string:

GET /something?api_key=abcdef12345

or as a request header:

GET /something HTTP/1.1
X-API-Key: abcdef12345

or as a cookie:

GET /something HTTP/1.1
Cookie: X-API-KEY=abcdef12345

[optional Relevant Links:]

https://swagger.io/docs/specification/authentication/api-keys/ https://github.com/envoyproxy/gateway/issues/2630

mattklein123 commented 5 months ago

What exactly do you want this filter to do?

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

zhaohuabing commented 4 months ago

What exactly do you want this filter to do?

Hi @mattklein123 Thanks for looking into this issue and sorry for my delayed response.

The API key authentication filter can be used to authorize HTTP requests using the provided API key in the request. API keys are a simple and widely used method in web services to ensure that only authorized applications and users can interact with the API. It would be beneficial if Envoy could support this feature. There are also some users asking for this feature in envoy gateway. https://github.com/envoyproxy/gateway/issues/2630

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 months ago

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

sanposhiho commented 2 months ago

Hi 👋 I'm coming from https://github.com/envoyproxy/gateway/issues/2630, interested in realizing it. Actually I'm researching other competing gateways, and actually Key auth functionality is one of the gaps that some other implementations implement, while the envoy doesn't. So, I believe it's worthy enough.

I can take an implementer part, would any maintainer be willing to help in reviewing etc to promote it?

gecube commented 2 months ago

It is very pity that we don’t have reliable and out-of-box way to use api keys in envoy proxy.

arkodg commented 1 month ago

although API Key Auth is not the most secure or the most performant way to do authn & authz, its still used in existing brownfield environments and also as an additional auth mechanism like the one outlined here, so having support for it would unblock migration to envoy proxy. Here are the requirements that necessitates a new filter instead of reusing an existing one like the RBAC filter

gecube commented 1 month ago

Agree, that it is essential functionality.

wbpcode commented 1 month ago

I agree this is essential functionality. I can help with the review if someone want to contribute.

sanposhiho commented 1 month ago

Thanks @wbpcode! I'll ping you when I create the PR.

sanposhiho commented 1 month ago

/assign

repokitteh-read-only[bot] commented 1 month ago

sanposhiho is not allowed to assign users.

:cat: Caused by: a https://github.com/envoyproxy/envoy/issues/34877#issuecomment-2423905735 was created by @sanposhiho. see: [more](https://github.com/envoyproxy/envoy/issues/34877#issuecomment-2423905735), [trace](https://prod.repokitteh.app/traces/ui/envoyproxy/envoy/cddcbd90-8e23-11ef-83f2-e7ef05c992f4).