> 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-restricted-to-use-by-specified-hosts-and-apps.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# GCP API key not restricted to use by specified Hosts and Apps

### Synopsis

| Field               | Value                                                         |
| ------------------- | ------------------------------------------------------------- |
| Rule Type           | Detection                                                     |
| Finding Type        | GCP API key not restricted to use by specified Hosts and Apps |
| Finding ID          | 60000664                                                      |
| 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 and data breaches. These keys, if exposed, can be easily misused by malicious actors.

GCP API keys are used to authenticate requests to GCP services. Failing to restrict API key usage to specific hosts and applications allows anyone with access to the key to make requests, bypassing authentication mechanisms. This misconfiguration could lead to data exfiltration, service disruption, or unauthorized resource modification.

The impact of this misconfiguration includes data breaches, service disruptions, and significant financial losses. Restricting API key access to trusted sources significantly reduces the attack surface and minimizes the potential damage from compromised keys. This is a crucial security best practice for protecting sensitive data and ensuring service availability.

Mitigate this risk by restricting each GCP API key to only trusted hosts and applications. Implement strong access controls and regularly review and update the list of trusted entities. Consider using service accounts instead of API keys whenever possible for improved security.

### Remediation

1. Log in to google cloud console
2. Navigate to 'Credentials', Under service 'APIs & Services' (Left Panel)
3. In the section 'API Keys', Click on the reported 'API Key Name'
4. In the 'Key restrictions' section, set the application restrictions to any of HTTP referrers, IP Adresses, Android Apps, iOS Apps.
5. Click 'SAVE'.

Note: Do not set 'HTTP referrers' to wild-cards (\* or \*.\[TLD] or *.\[TLD]/*).

Do not set 'IP addresses' restriction to any overly permissive IP (0.0.0.0 or 0.0.0.0/0 or ::0 or ::/0)


---

# 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-restricted-to-use-by-specified-hosts-and-apps.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.
