# GCP

The OX GCP connector connects OX Security to your Google Cloud environment and provides cloud-level visibility, asset context, and Kubernetes deployment enrichment across the platform.

The connector enables OX to collect metadata from your Google Cloud environment and correlate it with applications, workloads, container images, and security findings.

The GCP connector is also required when [connecting Google Kubernetes Engine (GKE)](/ox-integrations/3rd-party-integrations/cloud-security/gcp-and-gke-1/gcp-and-gke.md) clusters to OX.

### What the GCP connector provides

<table><thead><tr><th width="300.666748046875">Capability</th><th>Description</th></tr></thead><tbody><tr><td>Cloud asset visibility</td><td>Identifies assets deployed in your Google Cloud environment</td></tr><tr><td>Kubernetes enrichment</td><td>Adds deployment and runtime context for GKE workloads</td></tr><tr><td>Internet exposure context</td><td>Detects whether workloads are publicly reachable</td></tr><tr><td>Cloud BOM generation</td><td>Builds a cloud-based bill of materials (Cloud BOM)</td></tr><tr><td>Runtime-aware prioritization</td><td>Enriches issues with severity context based on live deployment status</td></tr><tr><td>Attack path visibility</td><td>Extends Attack Path analysis with cloud reachability information</td></tr></tbody></table>

### Kubernetes connection models

OX supports two Kubernetes connection models:

| Connection model            | Description                                                                                                                                                                 |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Direct cloud integration    | <p>OX connects directly to GKE through Google Cloud APIs.<br>Use direct integration when the cluster is externally reachable.</p>                                           |
| Inspector-based integration | <p>The Inspector runs inside the environment and sends Kubernetes data to OX.<br>Use the Inspector when clusters are private, restricted, or not externally accessible.</p> |

### Enriched visibility across OX

After the connector is configured, cloud deployment context is reflected across multiple areas in OX.

| Area               | Enrichment                                                                         |
| ------------------ | ---------------------------------------------------------------------------------- |
| Applications       | Displays Kubernetes deployment details, Application Flow data, and deployment Tags |
| Active Issues      | Adds Kubernetes reachability and runtime severity factors                          |
| Attack Path        | Displays cloud and Kubernetes reachability paths                                   |
| Artifact BOM       | Shows where artifacts are deployed across cloud environments and clusters          |
| Artifact integrity | Detects images running from untrusted or unknown sources                           |

### Runtime-aware scanning

OX scans the specific container image versions that are actively running in your cloud environment, not only the latest versions available in the registry.

This improves prioritization accuracy and reduces unnecessary scanning noise.

### Supported environments

The GCP connector supports:

* Google Cloud Platform (GCP)
* Google Kubernetes Engine (GKE)
* Inspector-based Kubernetes deployments running in Google Cloud

## Prerequisites

* A Google Cloud project with IAM permissions to:
  * Create service accounts
  * Manage service account keys
* Enable required APIs (e.g., Compute Engine API, IAM API, Kubernetes Engine API).
* Optional: `gcloud` CLI installed and configured.

## Step 1: Create a new service account \[Google]

1. Log in to the [Google Cloud Console](https://console.cloud.google.com).
2. Select your GCP project.
3. Navigate to **IAM & Admin**.
4. Select **Service Accounts**.

<figure><img src="/files/ndGZg4giFwnwfohOAex5" alt=""><figcaption></figcaption></figure>

5. Select **+ Create Service Account**.

<figure><img src="/files/h0uORN0gY51ck9FVZOzw" alt="" width="430"><figcaption></figcaption></figure>

6. Add a meaningful name and an optional description.
7. Select **Create and Continue**.

<figure><img src="/files/nv2odyLW4jiv7bduRv7k" alt="" width="418"><figcaption></figcaption></figure>

8. Grant one of the following roles:

<table><thead><tr><th width="294.8333740234375">Role</th><th>Description</th></tr></thead><tbody><tr><td><strong>Access Approval Viewer</strong></td><td>Read-only access to Access Approval settings and approval requests.</td></tr><tr><td><strong>Access Context Manager Reader</strong></td><td>Read-only access to Access Context Manager resources, including access policies, access levels, and service perimeters (VPC Service Controls).</td></tr><tr><td><strong>Discovery Engine Viewer</strong></td><td>Read-only access to Vertex AI Search &#x26; Conversation (Discovery Engine) resources.</td></tr><tr><td><strong>Firebase Rules Viewer</strong></td><td>Read-only access to Firebase Security Rules.</td></tr><tr><td><strong>Firebase Viewer</strong></td><td>Read-only access to all Firebase resources and configuration within a project, including databases, hosting, authentication settings, and functions.</td></tr><tr><td><strong>Healthcare Dataset Viewer</strong></td><td>Read-only access to Cloud Healthcare API datasets and their metadata.</td></tr><tr><td><strong>Security Reviewer</strong></td><td>Read-only access to all resources for the purpose of security auditing.</td></tr><tr><td><strong>Storage Object Viewer</strong></td><td>Read-only access to objects within Cloud Storage buckets.</td></tr><tr><td><strong>Viewer</strong></td><td>Read-only access to all Google Cloud resources within a project (basic role).</td></tr></tbody></table>

9. Select **Done**. The new service account appears in the **Service accounts** table.

<figure><img src="/files/Lscy78DqROjJPEdZkzCh" alt=""><figcaption></figcaption></figure>

10. In the **Actions** column, select the newly created service account, click the three dot menu related to it, and select **Manage keys**.
11. In the **Keys** pane, select **Add key > Create new key**.

<figure><img src="/files/kMG5ZTPVEnAOcYORIQfB" alt=""><figcaption></figcaption></figure>

12. Select **JSON** and then select **Create**. The file is automatically downloaded to your system.
13. Securely store the JSON key file.
14. To encode the Key File in Base64:

* On **macOS/Linux**, run: `base64 -i <filename>.json`
* On **Windows**, use a tool or plugin to convert the JSON to a one-line Base64 string.

> **Note:** The Base64 encoding ensures multi-line keys are compacted into a single string.

15. To enable the required Google Cloud APIs, in the **Google Cloud Console**:
16. To enable the required Google Cloud APIs, in the **Google Cloud Console**:

    a. Navigate to **APIs & Services**.

    b. In the left pane, select **Library**.

    c. Search for and enable the following APIs:

    * Compute Engine API (`compute.googleapis.com`)
    * Kubernetes Engine API (`container.googleapis.com`)
    * Cloud Resource Manager API (`cloudresourcemanager.googleapis.com`)

<figure><img src="/files/NXQUf4jYcWTIbvHvxgHA" alt="" width="544"><figcaption></figcaption></figure>

d. Alternatively, use the `gcloud` CLI to enable all the required APIs at once:

```bash
    gcloud services enable \
  aiplatform.googleapis.com \
  appengine.googleapis.com \
  artifactregistry.googleapis.com \
  bigquery.googleapis.com \
  cloudfunctions.googleapis.com \
  cloudkms.googleapis.com \
  cloudresourcemanager.googleapis.com \
  compute.googleapis.com \
  container.googleapis.com \
  containerregistry.googleapis.com \
  dataproc.googleapis.com \
  datastore.googleapis.com \
  discoveryengine.googleapis.com \
  dns.googleapis.com \
  firebase.googleapis.com \
  firebasedatabase.googleapis.com \
  firebaserules.googleapis.com \
  firestore.googleapis.com \
  healthcare.googleapis.com \
  iam.googleapis.com \
  logging.googleapis.com \
  monitoring.googleapis.com \
  pubsub.googleapis.com \
  redis.googleapis.com \
  run.googleapis.com \
  secretmanager.googleapis.com \
  spanner.googleapis.com \
  sqladmin.googleapis.com \
  storage.googleapis.com
```

> **Note:** The CLI command enables a broader set of APIs than the minimum required for GKE. The additional APIs (such as BigQuery, Cloud KMS, and Dataproc) support other GCP features that OX Security may scan. If you prefer to enable only the minimum required APIs, use the manual UI steps in step 16c above.

e. To verify the APIs were enabled, run:

```
gcloud services list --enabled
```

## Step 2: Connect to GCP

1. In the **Google Cloud Console**, locate the ID of the project in which you have created a service account.

<figure><img src="/files/r4eL4ElM8jUnOGkxEzbg" alt="" width="563"><figcaption></figcaption></figure>

2. In the **OX Security** platform, go to **Connectors** and search for **GCP**.

<figure><img src="/files/L6p5rRrD8w2fBiOSDGFj" alt="" width="155"><figcaption></figcaption></figure>

3. Select **GCP** and set the following parameters in the **Configure your GCP credentials** dialog.

<figure><img src="/files/paBwoapUr2y4Ee01NpDl" alt="" width="539"><figcaption></figcaption></figure>

| Parameter         | Description                    |
| ----------------- | ------------------------------ |
| **Project ID**    | Copy the value from the step 1 |
| **API** **Token** | Base64-encoded key             |

4. Select **CONNECT**. A success message appears.

## Multi-project access

**To reuse one service account across multiple GCP projects:**

1. [Create a new service account](#creating-a-new-service-account).
2. In the source project, copy the email of the service account.

<figure><img src="/files/5JJiMQdY8XvKJ6fOJjrr" alt=""><figcaption></figcaption></figure>

3. For each target project, navigate to **IAM & Admin** and select **Grant Access**.

<figure><img src="/files/DJHrsEuGtDLvOh91g40n" alt="" width="453"><figcaption></figcaption></figure>

4. In the **New principals** box, add the copied email address.
5. In the **Role** box, select the role that you want:

<table><thead><tr><th width="294.8333740234375">Role</th><th>Description</th></tr></thead><tbody><tr><td><strong>Access Approval Viewer</strong></td><td>Read-only access to Access Approval settings and approval requests.</td></tr><tr><td><strong>Access Context Manager Reader</strong></td><td>Read-only access to Access Context Manager resources, including access policies, access levels, and service perimeters (VPC Service Controls).</td></tr><tr><td><strong>Discovery Engine Viewer</strong></td><td>Read-only access to Vertex AI Search &#x26; Conversation (Discovery Engine) resources.</td></tr><tr><td><strong>Firebase Rules Viewer</strong></td><td>Read-only access to Firebase Security Rules.</td></tr><tr><td><strong>Firebase Viewer</strong></td><td>Read-only access to all Firebase resources and configuration within a project, including databases, hosting, authentication settings, and functions.</td></tr><tr><td><strong>Healthcare Dataset Viewer</strong></td><td>Read-only access to Cloud Healthcare API datasets and their metadata.</td></tr><tr><td><strong>Security Reviewer</strong></td><td>Read-only access to all resources for the purpose of security auditing.</td></tr><tr><td><strong>Storage Object Viewer</strong></td><td>Read-only access to objects within Cloud Storage buckets.</td></tr><tr><td><strong>Viewer</strong></td><td>Read-only access to all Google Cloud resources within a project (basic role).</td></tr></tbody></table>

6. Click **Save**.
7. In the **OX Security** platform, go to **Connectors** and search for **GCP**.
8. Select **GCP** and set the following parameters in the **Configure your GCP credentials** dialog.

<figure><img src="/files/paBwoapUr2y4Ee01NpDl" alt="" width="539"><figcaption></figcaption></figure>

| Parameter         | Description        |
| ----------------- | ------------------ |
| **Project ID**    | Add \*             |
| **API** **Token** | Base64-encoded key |

9. Select **CONNECT**. A success message appears.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ox.security/ox-integrations/3rd-party-integrations/cloud-security/gcp-and-gke-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
