CI/CD Secrets
Overview
CI/CD secrets protect deployment credentials, registry tokens, and signing keys used in automation pipelines.
Secure Pipeline Practices
- Use built-in secret stores from CI platforms
- Mask secrets in logs
- Restrict secret usage by environment and branch
- Use short-lived tokens when possible
flowchart TD
A[Pipeline Job] --> B[Secret Store]
B --> C[Runtime Secret Injection]
C --> D[Deployment Step]
Practical Example
steps:
- name: Deploy
env:
API_TOKEN: ${{ secrets.DEPLOY_API_TOKEN }}
Production Example
Teams commonly separate non-production and production credentials with approval gates to prevent accidental promotion misuse.
Common Pitfalls
- Echoing secrets in debug output
- Reusing one token across many pipelines
- Missing secret rotation during personnel changes
Key Takeaways
- CI/CD secret handling is a critical supply-chain control.
- Runtime-only injection reduces leakage risk.
- Segmentation and rotation improve security posture.