What are best practices for managing secrets (API keys, tokens) in CI/CD pipelines?
- Use secret managers or CI secret stores (not plain env files)
- Limit scope/TTL; rotate regularly; least privilege
- Avoid printing secrets; enable masking and audit
- 💡HashiCorp Vault, AWS Secrets Manager, GitHub Actions secrets.
- ⚠️Storing secrets directly in source control (e.g., Git repositories), even in private repos.
- ⚠️Hardcoding secrets into application code or configuration files instead of using a secret manager.
- ⚠️Using plain, unencrypted environment variables without robust platform-level protection for secrets in production CI/CD.
- ⚠️Failing to rotate secrets regularly or having overly long Time-To-Live (TTL) for credentials.
- ⚠️Printing secrets to logs or build outputs, making them visible to anyone with access to pipeline execution records.
- ❓How do you handle PR builds from forks?
- ❓What is OIDC for cloud creds?
Ready to prove your Kubernetes security knowledge?
Practice with free Certified Kubernetes Security Specialist (CKS) (CKS) exam questions. Instant answers and detailed explanations — no account required.
Start free practice quizQuestions that share similar topics with this one
Securing CI/CD Pipelines for Production
AdvancedCI vs CD vs CD
BeginnerCI Pipeline Parallelization Strategy
AdvancedSSL vs TLS
BeginnerSSH Keys vs Password Authentication
BeginnerDeepen your knowledge with these related blog posts
From DevOps to DevSecOps: Why Security-First Pipelines Are Becoming Mandatory
Discover why organizations are rapidly adopting DevSecOps practices and how to implement security-first CI/CD pipelines that protect against modern threats while maintaining development velocity.
CI/CD at Scale: Designing Fast, Flaky-Resistant Pipelines
Build CI/CD pipelines that scale. Learn how to design faster builds, reduce test flakiness, add security gates, and deploy confidently without slowing down engineering teams.
GitHub Self-Hosted Runners on AWS: Pull vs Push for On-Demand Scaling
Cut your CI costs by running GitHub Actions on AWS only when you need them. Compare pull-based (polling) and push-based (event-driven) architectures for spinning up on-demand self-hosted runners.