Ensure that all your Google Cloud projects are using standard authentication flow instead of API keys for authentication. Google Cloud Platform (GCP) API keys are simple encrypted strings that can be used when calling certain APIs which don't need to access private user data. GCP API keys are usually accessible to clients, as they can be publicly viewed from within a browser, making it easy to discover and steal an API key.
Because only a limited number of Google Cloud services allow access using just API keys, without requiring another type of credential, Google recommends using a standard authentication flow instead of API keys for most applications. Deleting GCP API keys should enforce the use of secure authentication methods only and minimize the exposure to attacks.
Note: There are limited use cases where API keys are preferred. For example, if there is a mobile application that needs to use the Google Cloud Translation API, but doesn't require a backend server, API keys are the simplest way to authenticate to that Google Cloud API. Therefore, make sure that your API keys are reviewed before removal as deleting API keys may break communication with the clients and/or applications that are using those keys.
Audit
To determine if your Google Cloud Platform (GCP) projects are using API keys, perform the following operations:
Remediation / Resolution
To delete any API keys associated with your Google Cloud Platform (GCP) projects, perform the following operations:
References
- Google Cloud Platform (GCP) Documentation
- Authentication overview
- Using API keys
- CIS Security Documentation
- Securing Google Cloud Computing Platform
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gcloud alpha services api-keys list
- gcloud alpha services api-keys delete