CICD-367 · Short-lived credential generation
Encyclopedia · Advanced security and compliance · All snippets
Previous · CICD-366 · Next · CICD-368
1. Where it fits
- Placement CI run step or authorized lab terminal.
- Prerequisites reviewed policies, a short-lived CI identity, and synthetic or approved test inputs.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
vault token capabilities database/creds/ci-read | grep -Fx read
vault read -format=json database/creds/ci-read | jq -e '.lease_duration <= 900 and .renewable != null' >/dev/null3. How it works
Vault evaluates the configured role, policy and lease. Limit what is printed and keep credentials scoped to the trusted step. The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.
4. Verify the result
Use a Vault database role configured for a short lease. The probe discards username and password and must run without shell tracing.
Watch for. Use the intended trusted execution context. Keep secret values out of traces, artifacts and debug output.
Validation syntax-validated (Bash parse). Status definitions.