Check ID:
Provider: GCP
Service:
Severity: HIGH
Categories:
Resource type:
apikeys_api_restricted_with_gemini_apiProvider: GCP
Service:
apikeysSeverity: HIGH
Categories:
secrets, gen-ai, identity-accessResource type:
apikeys.googleapis.com/KeyWhat this check verifies
The Gemini API (a.k.a. Generative Language API,generativelanguage.googleapis.com) uses API keys to authenticate requests for uploaded files and cached content. For projects with the Gemini API enabled, each API key should have API restrictions configured to limit access to specific services.
Risk
Leaked, unrestricted API keys allow access to sensitive uploaded files and cached content, impacting their confidentiality. The risk of leaks is particularly high because traditionally, Google API keys were not considered sensitive and might be embedded in website source code, mobile apps, etc.Recommendation
Apply API restrictions so that each key only has access to specific APIs. Do not allow access to the “Generative Language API” in particular. If access to the “Generative Language API” is required, be aware of the consequences. Only use the key for this specific purpose and ensure adequate secrets storage. Alternatively, completely disable the Gemini API (a.k.a. Generative Language API,generativelanguage.googleapis.com) in the project’s enabled services.
Remediation
- CLI
- Terraform
- Dashboard steps
References
- https://trufflesecurity.com/blog/google-api-keys-werent-secrets-but-then-gemini-changed-the-rules
- https://cloud.google.com/docs/authentication/api-keys
Where this check fires
This check runs on every scheduled scan against your GCP account. Findings appear at Cloud Security → Findings filterable byCheck ID = apikeys_api_restricted_with_gemini_api. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to GCP checks