Replies: 9 comments 5 replies
-
API Key Generation and ValidationAPI keys can be generated by the gateway, the management portal, or the developer portal. Each issuing component stores generated API keys in its own database. Since the API key itself carries no issuer information, the gateway will need a way to determine which component issued a given key in order to validate that key. Possible approaches include:
In my opinion using a short prefix in API key that indicates issuer is the better approach. WDYT? And please provide alternative approaches to these. |
Beta Was this translation helpful? Give feedback.
-
API Key cachingCaching the API keys in the gateway policy engine (in memory) will reduce latency. Handling revocation of API keysInvalidate the cache if an API key is revoked.
|
Beta Was this translation helpful? Give feedback.
-
|
I see that we are considering making the API controller (control plane of a given gateway) playing a role in validating API keys. I'm not sure that is right. So far we've only considered the router and policy engine to be involved with processing API calls. The Gateway Controller is intended as a control plane for the gateway only. |
Beta Was this translation helpful? Give feedback.
-
|
I'd like to see more information on this API key. Can you please provide the following?
|
Beta Was this translation helpful? Give feedback.
-
|
Hi all, All the API Keys generated from every service would have the prefix API key validation would happen against the in memory map of API keys in the policy engine.
Request body - All of the fields in the request body are optional.
Response - The api_key field in the response would be empty if the API key generation is unsuccessful. The following are the defaults if the values are not provided in the API key generation request -
In the DB the API key has the following properties -
If an API consumer has forgot the value of the API key, they can invoke the |
Beta Was this translation helpful? Give feedback.
-
|
Several suggestions I think are important to consider.
I have several questions.
|
Beta Was this translation helpful? Give feedback.
-
|
Revoke API Key Revokes a given API key of an API
Request - Response - Remove the API key from the gateway controller DB and the gateway controller in memory cache. Then remove the api key from the policy engine. First validate the API exists and fetch the API key from the in memory store of the gateway controller.
If these pass, revoke the API key.
Upon the failure message "failed to revoke API key" the user might try to again revoke the API key. The aforementioned process is idempotent so that a partial removal of an API key in the case of a failure does not make the state of the different components to be inconsistent and does not fail when trying to revoke it again. |
Beta Was this translation helpful? Give feedback.
-
|
The OpenAPI definition and endpoints for the API key related operations are refactored to better align with REST API practices and clarity. Generate API key
The APIKeyGenerationRequest schema allows both List API keys
Rotate API key
Revoke API key
|
Beta Was this translation helpful? Give feedback.
-
API Key HashingThe API keys need to hashed and stored to prevent exposing the api keys in an event where the database is compromised. The random part of the API keys is 32 bytes long. The resultant random byte string of 32 bytes are then hex encoded, giving a api key length of 64 characters. Since the generated API keys are high entropy, we use SHA256 with a random salt of 32 bytes as the hashing algorithm as default. bcrypt and argon2id are supported strong hashing algorithms to hash API keys. Hashing the API keys using these algorithms results in a hash that is much harder to break and is Post Quantum safe. Hashing keys using these algorithms is resource intensive and the resource allocations for the gateway controller and policy engine containers from the docker compose need to be increased. Disabling API key hashing in production environments is highly discouraged. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
APIs need a standard, attachable policy to secure them using API keys.
Proposed Solution
Introduce an "API Key Authentication" policy that can be attached to APIs to secure them using API keys. The policy declares how the API key is presented and how to process it in the policy engine for validation, and enables the gateway to validate keys by calling the appropriate backend that issued the key.
Policy parameters:
API keys will be opaque tokens rather than JWTs. This is because opaque tokens simplifies revocation and lifecycle management.
Key lifecycle and validation:
Beta Was this translation helpful? Give feedback.
All reactions