Google Cloud Asset Inventory Executor¶
Category: Cloud Security
Script: gcp_asset_inventory.py
Integration: Python SDK (google-cloud-asset)
Faraday Plugin: Raw JSON
Website: https://cloud.google.com/asset-inventory
Description¶
Imports the cloud assets of a GCP organization from Cloud Asset Inventory into Faraday as hosts (inventory only, no vulnerabilities). Run it together with the gcp_scc executor to have Security Command Center findings attach to these hosts.
Prerequisites¶
- The
google-cloud-assetPython library installed in the agent environment - A GCP service account with the
roles/cloudasset.viewerrole (or a custom role withcloudasset.assets.listResource) on the organization - The service account JSON key file on the agent machine
- The numeric ID of your GCP organization
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
GOOGLE_APPLICATION_CREDENTIALS |
Yes | Path to the service account JSON key file (e.g., /etc/faraday/gcp-asset-key.json) |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
GCP_ORGANIZATION_ID |
string | Yes | Numeric ID of the GCP organization to query |
ASSET_TYPES |
string | No | Comma-separated GCP asset types to import (e.g., compute.googleapis.com/Instance,storage.googleapis.com/Bucket). Default: all types. |
YAML Configuration Example¶
executors:
gcp_asset_inventory:
repo_executor: gcp_asset_inventory.py
max_size: 65536
varenvs:
GOOGLE_APPLICATION_CREDENTIALS: "/etc/faraday/gcp-asset-key.json"
params:
GCP_ORGANIZATION_ID:
mandatory: true
type: string
base: string
ASSET_TYPES:
mandatory: false
type: string
base: string
How It Works¶
- Checks that the file in
GOOGLE_APPLICATION_CREDENTIALSexists and uses it for authentication - Lists the assets of
organizations/{GCP_ORGANIZATION_ID}with the Cloud Asset Inventory API (resource content), restricted toASSET_TYPESwhen set - Creates one host per asset (duplicates are skipped):
- IP: the real IPv4 address when the resource has one (e.g., Compute Engine instances and addresses), otherwise
0.0.0.0 - Hostname: the asset's display name, or its full GCP resource name
- Description: asset type, project, location, status and other resource details
- IP: the real IPv4 address when the resource has one (e.g., Compute Engine instances and addresses), otherwise
Notes¶
- The executor creates hosts only; it does not create vulnerabilities.
- The executor fails if
GOOGLE_APPLICATION_CREDENTIALSis missing or does not point to an existing file. GCP_ORGANIZATION_IDalso accepts theorganizations/<id>form.ASSET_TYPESentries that do not look like<service>.googleapis.com/<Type>are dropped and logged.- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor.