Best practices to keep secrets out of GitLab repositories
Oct 31, 2024Matt Coons

Summary
This post reinforces best practices for preventing secrets from being exposed in GitLab repositories. It highlights the importance of limiting public visibility of projects, securing CI secrets using external secret managers (GCP Secret Manager, AWS KMS, HashiCorp Vault), and enabling GitLab's comprehensive secret detection capabilities: secret push protection, pipeline secret detection, and client-side secret detection. It also provides guidance on incident response for accidental credential leaks, including resetting credentials and reviewing logs.
More from the GitLab Secrets Manager trail
- GitLab Secrets Manager adds ESO, Terraform, API support
- Manage CI/CD credentials with GitLab Secrets Manager
- A leaked personal access token shouldn't expose every project its owner can reach. Fine-grained PATs scope each token’s permissions to the job.
- Solving complex challenges with GitLab Duo Workflow
- How to scan a full commit history to detect sensitive secrets