> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-api-key-not-restricting-any-specific-api.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# GCP API key not restricting any specific API

### Synopsis

| Field               | Value                                        |
| ------------------- | -------------------------------------------- |
| Rule Type           | Detection                                    |
| Finding Type        | GCP API key not restricting any specific API |
| Finding ID          | 60000653                                     |
| Generates a Finding | This detection rule also generates a finding |
| Severity            | Medium                                       |
| Category            | CONFIGURATION                                |
| Cloud Providers     | GCP                                          |
| Platform Module     | CSPM                                         |
| Asset Types         | GOOGLE\_API\_KEYS                            |

### Description

Unrestricted Google Cloud Platform (GCP) API keys pose a significant security risk, enabling unauthorized access to various GCP services. These keys, often exposed unintentionally, allow malicious actors to perform actions without proper authentication.

GCP API keys provide access to various services. Failing to restrict an API key to specific APIs means any application possessing the key can access all enabled APIs. This misconfiguration exposes sensitive data, allows unauthorized resource modifications, and facilitates lateral movement within the GCP environment, potentially leading to a full-blown compromise.

The impact of this misconfiguration includes data breaches, service disruptions, and financial losses. Restricting API keys to only necessary APIs limits the potential damage from compromise, containing the blast radius of an attack. This best practice enhances security by adhering to the principle of least privilege.

To mitigate this risk, implement granular access control for each API key. Define the specific APIs each key can access. Regularly review and revoke unused or overly permissive API keys. Consider using service accounts instead of API keys whenever possible, as they offer more robust security features and better auditing capabilities.

### Remediation

1. Log in to google cloud console
2. Navigate to 'Credentials', Under service 'APIs & Services'
3. In the section 'API Keys', Click on the reported 'API Key Name'
4. In the 'Key restrictions' section go to 'API restrictions'.
5. Select the 'Restrict key' and from the drop-down, choose an API.
6. Click 'SAVE'.

Note: Do not set 'API restrictions' to 'Google Cloud APIs', as this option allows access to all services offered by Google cloud.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-api-key-not-restricting-any-specific-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
