Skip to main content

Gcp Sm

@swamp/gcp-smv2026.10.23.1· AGPL-3.0-or-later(was none)· 2d agoVAULTS
01README

Read, write, and delete secrets stored in Google Cloud Secret Manager, with support for vault annotations (swamp vault annotate / swamp vault inspect) and cross-project metadata-only hygiene inventory. Emits OpenTelemetry spans for vault operations so failures and latency are attributable in traces when a TracerProvider is configured.

Deletion is immediate and irreversible — GCP Secret Manager has no recovery window. The secret and all its versions are permanently removed.

Authentication

Uses the standard GCP credential chain via the gcloud CLI — no credentials in config. Provide credentials via one of:

  • Environment variable: GCP_ACCESS_TOKEN (pre-obtained OAuth2 token)
  • Inline JSON: GOOGLE_APPLICATION_CREDENTIALS_JSON
  • File path: GOOGLE_APPLICATION_CREDENTIALS
  • Application Default Credentials: gcloud auth application-default login

Required IAM Permissions

  • secretmanager.secrets.create
  • secretmanager.secrets.get
  • secretmanager.secrets.list
  • secretmanager.secrets.update
  • secretmanager.secrets.delete
  • secretmanager.versions.add
  • secretmanager.versions.access
  • secretmanager.versions.list (for hygiene inventory)

Annotations

Annotations map to native GCP Secret Manager primitives:

  • notes → secret annotations field (swamp-notes key)
  • url → secret annotations field (swamp-url key)
  • labels → secret labels field (swamp- prefixed keys)
swamp vault annotate my-gcp-sm API_KEY \
  --url https://console.cloud.google.com/security/secret-manager \
  --note "Production API key" \
  --label env=prod --label team=infra
swamp vault inspect my-gcp-sm API_KEY --json

Usage

swamp vault create @swamp/gcp-sm my-gcp-sm \
  --config '{"project_id": "my-project"}' --json

swamp vault read-secret my-gcp-sm my-secret --json
swamp vault put my-gcp-sm my-secret "s3cr3t" --json
swamp vault delete my-gcp-sm my-secret --json
swamp vault list-keys my-gcp-sm --json

Hygiene Inventory

The inventoryHygieneMetadata method produces a metadata-only snapshot across explicit project parents. It lists all secrets and their versions (metadata only — never calls versions.access) and captures rotation schedules, version state, and creation times. Useful for reporting rotation-notification gaps and latest-enabled-version age without accessing actual secret payloads.

Emulator Support

For local development and testing, set api_endpoint to point at a GCP Secret Manager emulator (e.g. floci-gcp). Authentication is skipped when a custom endpoint is configured.

swamp vault create @swamp/gcp-sm my-local-sm \
  --config '{"project_id": "floci-local", "api_endpoint": "http://localhost:4588"}' --json

Secret Key Format

Secret keys are mapped to GCP secret IDs. Slashes in key names are replaced with hyphens (/ → -) since GCP secret IDs only allow [a-zA-Z0-9_-].

02Release Notes
  • Added: inventoryHygieneMetadata method for cross-project metadata-only secret/version hygiene snapshots (rotation schedules, version state, creation times — never accesses payloads)
03Vaults1
GCP Secret Managerconfigurable
@swamp/gcp-smgcp_sm.ts

Google Cloud Secret Manager vault provider. Uses Application Default Credentials (ADC) for authentication.

Config Fields

FieldTypeDescription
project_id?stringGCP project ID (falls back to GOOGLE_CLOUD_PROJECT env var or ADC default)
secret_prefix?stringPrefix to namespace secrets within the project
api_endpoint?stringCustom API endpoint for emulators (e.g. http://localhost:4588 for floci-gcp)
04Previous Versions4
2026.10.13.1
  • Added: inventoryHygieneMetadata method for cross-project metadata-only secret/version hygiene snapshots (rotation schedules, version state, creation times — never accesses payloads)
2026.09.17.0
  • Added: inventoryHygieneMetadata method for cross-project metadata-only secret/version hygiene snapshots (rotation schedules, version state, creation times — never accesses payloads)
2026.09.10.0
2026.08.11.0
05Stats
B
87 / 100
Downloads
122
Archive size
27.5 KB
Verified by Swamp
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented0/1missing
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault0/1missing
    • files/README.md--Line 55 passes the secret's value to `swamp vault put` on the command line, where shell history keeps it. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
    • manifest.yaml--The description passes the secret's value to `swamp vault put` on the command line, where shell history keeps it. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.

    Fix or accept each secret-unsafe-docs warning: the README, the manifest description and describe strings should store secrets with `swamp vault put <vault> <key>` (it prompts for the value) and pass them as `${{ vault.get(<vault>, <key>) }}`.

  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
06Platforms
07Labels