Metadata-Version: 2.5
Name: zerobom-gcp
Version: 0.1.0
Summary: GCP Artifact Analysis and GCS SBOM inventory backend plugins for zerobom.
Project-URL: Homepage, https://zerobom.dev/
Project-URL: Documentation, https://zerobom.dev/backends/
Project-URL: Repository, https://github.com/zerobom-dev/zerobom
Project-URL: Issues, https://github.com/zerobom-dev/zerobom/issues
Author: zerobom Contributors
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: artifact-analysis,gcp,gcs,pre-cve,sbom,zerobom
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: google-auth[requests]>=2.35
Requires-Dist: httpx>=0.27
Requires-Dist: zerobom<0.2.0,>=0.1.0
Provides-Extra: adc
Description-Content-Type: text/markdown

# zerobom-gcp

Google Cloud Platform inventory backend plugins for [`zerobom`](https://github.com/zerobom-dev/zerobom), integrating via standard `zerobom.backends` entry points:

- **`gcp_artifact_analysis`**: Queries GCP Container Analysis / Artifact Analysis occurrences (`kind="PACKAGE"` and/or `kind="SBOM_REFERENCE"` with SHA-256 verified GCS SBOM resolution), supporting global and regional (`location=...`) endpoints, CPE 2.2/2.3 OS distro resolution, and safe CEL filtering.
- **`gcs_sbom`**: Streams plain or `.gz`-compressed CycloneDX (1.4–1.6) and SPDX (2.2–2.3) JSON SBOMs concurrently from Google Cloud Storage prefixes (including Requester Pays via `user_project=...`).

## Installation

```bash
uvx "zerobom[gcp]" scan --osv advisory.osv.json --backend gcp_artifact_analysis --backend-opt project_id=my-gcp-project
```

Or install into an existing project environment:

```bash
pip install "zerobom[gcp]"
```

Application Default Credentials (`google-auth[requests]`) are included by default and refresh automatically across long-lived `watch` sessions.

## Usage Examples

### GCP Artifact Analysis (`gcp_artifact_analysis`)

```bash
zerobom scan \
  --osv advisory.osv.json \
  --backend gcp_artifact_analysis \
  --backend-opt project_id=my-prod-project \
  --backend-opt location=us \
  --backend-opt mode=both \
  --format sarif > results.sarif
```

Authentication priority:
1. Explicit `access_token` option
2. `ZEROBOM_GCP_ACCESS_TOKEN`, `ZEROBOM_GCP_TOKEN`, or `GOOGLE_OAUTH_ACCESS_TOKEN`
3. Automatic Application Default Credentials (disable fallback with `--backend-opt use_adc=false`)

Least-privilege IAM roles:
- `roles/containeranalysis.occurrences.viewer`
- `roles/storage.objectViewer` (when using `mode=sbom_reference` or `mode=both`)

### Google Cloud Storage SBOM Prefix (`gcs_sbom`)

```bash
zerobom scan \
  --osv advisory.osv.json \
  --backend gcs_sbom \
  --backend-opt bucket=corp-sboms \
  --backend-opt prefix=services/
```

Least-privilege IAM role: `roles/storage.objectViewer`.

## Documentation & License

- Documentation: https://zerobom.dev/backends/
- License: Apache-2.0
