TL;DR: Google API keys that were once treated as public identifiers can become high-risk credentials when Gemini is enabled in the same project, because unrestricted keys may now authorize costly AI requests and expose organisations to denial-of-wallet, abuse, and privacy risks, according to Equixly. The key issue is credential scope drift: older keys inherit new capabilities when AI services are added, so restriction and project isolation now matter as much as key visibility.
At a glance
What this is: Equixly explains how enabling Gemini can turn older, publicly exposed Google API keys into unexpectedly powerful credentials that can call billable AI endpoints.
Why it matters: IAM and security teams need to treat API key scope as a living control, because project changes can silently expand what a legacy key can do.
By the numbers:
- In just 48 hours, a charge rose 457 times above the typical monthly bill.
Context
API keys are often treated as low-risk project identifiers, but that assumption only holds while the enabled services behind the project stay narrow and stable. Once a project adds a generative AI service, the same key can inherit far more dangerous capabilities without any visible change to the key itself. That creates an identity and authorization problem, not just a billing problem.
The governance gap is credential scope drift: access that looked harmless when the key was created becomes risky after the platform expands. For IAM, NHI, and application security teams, this means key inventory alone is not enough. The effective permissions of the project and the key must be reviewed together, especially where public code, browser apps, or mobile binaries expose the credential.
Key questions
Q: What breaks when a public API key can also reach Gemini endpoints?
A: The main failure is that a credential once treated as a low-risk application identifier can suddenly authorize expensive AI requests. That expands the attack surface from simple misuse to token burn, service abuse, and potential privacy exposure. If the key is unrestricted, exposure becomes immediate exploitability rather than a theoretical secret-leak issue.
Q: Why do unrestricted project keys become dangerous after Gemini is enabled?
A: Because the security boundary moves from the key alone to the combination of the key, the project, and the enabled API set. If the project exposes Gemini and the key is not explicitly restricted, an attacker can use a leaked key to trigger AI requests at the owner’s expense and potentially reach functionality that was never intended for that credential.
Q: How do security teams know whether API key scope has drifted?
A: They should compare each key’s original intended use with the current services enabled in its project and check whether the key still has an API allowlist that matches that intent. If a key was safe for maps or frontend use but now sits in a project with Gemini enabled, the effective scope has changed even if the key string has not.
Q: What should teams do when AI agents depend on API keys and service accounts?
A: Treat those credentials as governed NHIs and put them through lifecycle controls for ownership, scope review, and offboarding. The key question is not only who created the credential, but whether it still matches the agent's current use case and whether its permissions are still justified.
Technical breakdown
Why public API keys stop being harmless once scope expands
A Google API key is not a user identity or a service account, but a project-level identifier used to authenticate calls to APIs that accept keys. That design is safe only when the key is tightly restricted to specific services and request origins. The problem begins when a project later enables a new API, because unrestricted keys can call any enabled service in that project. In practice, the credential does not change, but its effective authorization boundary does. That is classic scope drift, and it is especially dangerous in environments where keys are embedded in browser code, mobile apps, or shared configuration.
Practical implication: Treat the allowed API set as part of the credential lifecycle, not as a one-time setup choice.
How Gemini changes the risk profile of an API key
Gemini is materially different from read-only public APIs because each request can consume costly tokens and reach sensitive model endpoints. If the Generative Language API is enabled and the key is not explicitly restricted, a leaked key can authorize expensive generative requests from anywhere the network policy allows. The result is not just abuse of a public interface. It is unauthorized use of a billable AI service under the project’s identity, which can also expose fine-tuned models, internal prompts, or safety-bypassed interactions depending on how the application is wired.
Practical implication: Separate AI-capable projects from legacy API key use cases and restrict keys to specific allowed APIs.
Why budget controls do not replace access controls
Budget alerts and quotas can surface abuse, but they do not prevent the first wave of misuse. An attacker who finds an exposed key can script repeated Gemini calls before accounting systems react, creating denial-of-wallet pressure and potential denial of service for legitimate users. In governance terms, billing controls are detection and containment signals, not preventive authorization controls. The primary control remains service restriction, project isolation, and continuous review of keys whose original scope no longer matches the services now exposed by the project.
Practical implication: Use budgets as a backstop, not as the control that decides whether a key may reach a sensitive API.
Threat narrative
Attacker objective: The attacker wants to use a leaked project key to spend someone else’s AI budget, abuse the project’s identity, and potentially reach data or model behaviour the owner did not intend to expose.
- Entry occurs when an exposed Google API key is discovered in public code, a mobile binary, or a configuration file.
- Credential abuse follows when the attacker tests that key against a Gemini endpoint and confirms it can authorize requests in the enabled project.
- Escalation occurs when the attacker scripts high-volume generative calls, consuming tokens and using the project identity to drive unwanted AI activity.
- Impact lands as denial of wallet, service disruption, reputation risk, and possible exposure of model outputs or sensitive context.
Breaches seen in the wild
- OneLogin API flaw (CVE-2025-59363): A OneLogin API flaw exposed OIDC client secrets to anyone with an API key, including vendors (CVE-2025-59363); fixed with no customer impact.
- Dropbox Sign breach 2024: A compromised back-end service account gave attackers Dropbox Sign customer data, including API keys, OAuth tokens and MFA information.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Credential scope drift is the core governance failure here. A key that was acceptable when it only reached Maps or another narrow API becomes a materially different credential once Gemini is enabled in the same project. That means the control problem is not secret visibility alone, but the mismatch between credential lifecycle and project capability lifecycle. Practitioners should govern project expansion as an authorization event.
Public API keys are no longer just identifiers when they can reach AI services. The traditional split between a visible frontend key and a sensitive backend secret breaks down when the same key can trigger billable model calls. That creates an identity boundary problem for application teams, because the project identity can now be used to perform expensive or harmful actions. The practitioner conclusion is that key exposure must be assessed against enabled service scope, not in isolation.
AI workload isolation now belongs in the same conversation as API key management. If legacy keys and generative services share a project, old credentials inherit new risk without a lifecycle checkpoint. That is a weak operating model for both IAM and NHI governance, because the security state of the key changes when the cloud service catalog changes. Teams should treat AI enablement as a re-certification trigger for every key tied to that project.
Default-open architecture creates hidden security debt. When a platform adds powerful AI capabilities behind long-lived project keys, organisations accumulate a silent privilege expansion problem. The issue is not limited to Google APIs. Any environment that reuses old service credentials after new capabilities are introduced can create the same failure mode. Practitioners should assume scope drift will recur wherever lifecycle ownership is unclear.
API security and NHI governance now overlap more tightly than many teams expect. The article shows how a credential that was once considered operationally safe can become an NHI-like access path to a higher-risk service. That makes inventory, restriction, and offboarding discipline central to both application security and identity governance. The practical takeaway is to review whether legacy API keys are still governed as low-risk objects when the platform no longer treats them that way.
From our research library:
- 69% of organisations still authenticate machine identities with long-lived API keys, according to the 2026 State of AI Agent Identity Security Report.
- Read next: Guide to the Secret Sprawl Challenge
What this signals
Credential scope drift is becoming a routine identity problem in AI-enabled cloud projects. When a service like Gemini is enabled in the same project as older API keys, the credential’s effective privileges expand without a visible change to the key itself. That is why teams need lifecycle reviews tied to service enablement, not just to secret creation or rotation.
The scale of exposed machine credentials is already large enough to make this a governance issue, not an edge case. According to the 2026 State of AI Agent Identity Security Report, 69% of organisations still authenticate machine identities with long-lived API keys, which means many environments are structurally exposed to this kind of scope drift.
AI workload isolation should now be treated as a control boundary, not an architecture preference. Separate projects for legacy front-end keys and generative AI services reduce the chance that an old credential inherits dangerous new capabilities. For identity teams, the practical signal is simple: if the service catalog changes, the access model must be revalidated.
For practitioners
- Inventory all project API keys Identify every key linked to projects where Gemini or other generative APIs are enabled, then check whether each key still has the API allowlist and origin restrictions it was created with.
- Separate legacy and AI workloads Move Maps, Firebase, testing, and browser-facing keys into projects that do not host generative AI services, so a leaked legacy key cannot inherit access to Gemini endpoints.
- Enforce API allowlists on every exposed key Make API restrictions mandatory, not optional, and deny any key that can call a service outside its intended function even if network restrictions still pass.
- Use budget alerts as a detection signal Set thresholds that trigger investigation and key rotation when spend rises unexpectedly, but treat those alerts as late warning, not as a preventive control.
- Review exposed keys after new service enablement Whenever a team turns on Gemini or another high-cost API, re-certify the keys already present in that project and revoke any credential whose scope no longer matches the service set.
Key takeaways
- A Google API key can be low risk in one project and high risk in another when service enablement changes its effective scope.
- The most dangerous failure mode is not exposure alone, but exposure combined with unrestricted access to generative AI endpoints.
- Service isolation, API allowlists, and lifecycle review after new API enablement are the controls that limit this drift.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and OWASP API Security Top 10 address the attack and risk surface, while NIST CSF 2.0 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Leaked API keys are the entry point that lets attackers test Gemini access. |
| NHI-07 — Long-Lived Secrets | Older project keys remain valid while project scope expands around them. | |
| Recommendation — Scan exposed code and binaries for leaked API keys and revoke any credential found in public assets. Reduce long-lived API keys and re-certify their scope whenever new services are enabled. | ||
| OWASP API Security Top 10 | API2 — Broken Authentication | A key that can unexpectedly authenticate to Gemini reflects a broken boundary between intended and actual access. |
| API8 — Security Misconfiguration | Unrestricted keys in Gemini-enabled projects are a configuration failure, not a code flaw. | |
| Recommendation — Validate that API keys authenticate only the services they were explicitly allowed to reach. Harden API key restrictions and project settings so new services do not inherit unintended access. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | The article is fundamentally about permissions changing as project services change. |
| Recommendation — Review entitlement scope whenever a project adds new APIs and remove access that no longer matches intent. | ||
Key terms
- Credential scope drift: Credential scope drift occurs when the access a key effectively receives at runtime is broader than the permissions intended at creation. It often shows up through weak endpoint checks, overly permissive roles, or poor revocation handling, and it turns a narrow credential into an uncontrolled access path.
- API Allowlist: An API allowlist is a restriction that limits a key or token to a defined set of services. It prevents a credential from being reused against newly enabled endpoints, which makes it one of the most important controls for public-facing application keys.
- Denial of Wallet: Denial of wallet is an attack that weaponises pay-per-use pricing to create unsustainable cloud or AI spend. The attacker does not need to destroy infrastructure. They only need to trigger enough expensive usage to make the service economically unsafe to operate.
- Component-Level Identity: An access model that gives separate identities to the parts of a system that make decisions, invoke tools, or move data. For AI agents, this means the orchestrator, reasoning layer, and connectors are governed individually so attribution, policy enforcement, and incident review remain possible.
Deepen your knowledge
NHI Mgmt Group covers identity security, NHI governance, and agentic AI through independent research, practitioner guides, and the NHI Foundation Level course. Explore nhimg.org for resources that connect identity governance to the broader security disciplines your programme depends on.
Published by the NHIMG editorial team on August 19, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org