Back to controls

Ensure API keys are not created for a project

### Overview

Category

Controls

Low

Applies to

General guidance

Coverage

null controls, 0 queries

Asset types

Not specified

Overview

Overview

+API keys are weaker than identity-based authentication and are frequently exposed in client code and repositories. Projects should avoid API key usage when service accounts or stronger controls are available.

Remediation guidance

GCP remediation

+### Console +1. Open APIs and Services -> Credentials. +2. Identify and remove unnecessary API keys. +3. For keys that must exist temporarily, restrict by API, application, and source. +4. Prefer service accounts and workload identity over API keys. + +### Google Cloud CLI +List API keys in a project: + +~~~bash +gcloud services api-keys list --project +~~~ + +Delete an API key: + +~~~bash +gcloud services api-keys delete --project +~~~ + +### References +- https://cloud.google.com/api-keys/docs +- https://cloud.google.com/sdk/gcloud/reference/services/api-keys

Multiple Remediation Paths

Google Cloud

SERVICE-WIDE (RECOMMENDED when many resources are affected): Enforce Organization Policies at org/folder level so new resources inherit secure defaults.

gcloud org-policies set-policy policy.yaml

ASSET-LEVEL: Use the product-specific remediation steps above for only the impacted project/resources.

PREVENTIVE: Use org policy constraints/custom constraints and enforce checks in deployment pipelines.

References for Service-Wide Patterns

  • GCP Organization Policy overview: https://cloud.google.com/resource-manager/docs/organization-policy/overview
  • GCP Organization policy constraints catalog: https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints
  • gcloud org-policies: https://cloud.google.com/sdk/gcloud/reference/org-policies

Operational Rollout Workflow

Use this sequence to reduce risk and avoid repeated drift.

1. Contain at Service-Wide Scope First (Recommended)

  • Google Cloud: apply organization policy constraints at org/folder scope.
gcloud org-policies set-policy policy.yaml

2. Remediate Existing Affected Assets

  • Execute the control-specific Console/CLI steps documented above for each flagged resource.
  • Prioritize internet-exposed and production assets first.

3. Validate and Prevent Recurrence

  • Re-scan after each remediation batch.
  • Track exceptions with owner and expiry date.
  • Add preventive checks in IaC/CI pipelines.

Query logic

These are the stored checks tied to this control.

No stored query bodies are attached to this entry.

Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon