Credentials vaulted (no hardcoded secrets)
Demonstrate that all application and infrastructure credentials are stored in approved secret management systems and retrieved dynamically, with no secrets hardcoded in source code, configuration files, or deployment artifacts.
Description
What this control does
This control ensures that authentication credentials, API keys, tokens, passwords, certificates, and other secrets are not embedded directly in source code, configuration files, container images, or scripts. Instead, secrets must be stored in dedicated vaulting solutions (e.g., HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, CyberArk) and retrieved at runtime through secure APIs or environment variable injection. Hardcoded secrets create immutable attack surfaces: once committed to repositories or deployed to systems, they are difficult to rotate and vulnerable to exposure through code review, logs, or binary inspection. This control is critical for preventing credential leakage, enabling centralized secret rotation, and enforcing least-privilege access through dynamic credential provisioning.
Control objective
What auditing this proves
Demonstrate that all application and infrastructure credentials are stored in approved secret management systems and retrieved dynamically, with no secrets hardcoded in source code, configuration files, or deployment artifacts.
Associated risks
Risks this control addresses
- Attacker extracts hardcoded credentials from source code repositories (including commit history) to gain unauthorized access to production systems or databases
- Credentials embedded in container images or AMIs are discovered through image scanning or layer inspection, enabling lateral movement across cloud environments
- Inability to rotate compromised credentials rapidly because secrets are distributed across codebases, requiring code changes and redeployment cycles
- Accidental exposure of secrets in log files, error messages, or debug output where hardcoded credentials are passed as plaintext parameters
- Developer workstations or CI/CD pipeline artifacts containing hardcoded secrets are compromised, granting persistent access to production resources
- Insider threat actors with code repository access harvest credentials for unauthorized data exfiltration or system manipulation
- Third-party code dependencies or open-source contributions inadvertently expose organization-specific credentials committed to public repositories
Testing procedure
How an auditor verifies this control
- Obtain a complete inventory of applications, services, microservices, infrastructure-as-code repositories, and CI/CD pipelines in scope for the audit period.
- Request documentation of the organization's approved secret management solutions, including vault product names, deployment architecture, access control policies, and integration methods.
- Select a representative sample of source code repositories (minimum 10% or 15 repositories, whichever is greater) spanning different development teams and technology stacks.
- Execute automated secret scanning tools (e.g., TruffleHog, git-secrets, Gitleaks) against sampled repositories, including full commit history, to detect patterns matching credentials, API keys, private keys, and tokens.
- Manually inspect configuration files (e.g., application.properties, .env files, docker-compose.yml, Kubernetes manifests, Terraform configurations) within sampled repositories for plaintext credentials or suspicious base64-encoded strings.
- Review application runtime configuration by examining environment variable injection mechanisms, secret volume mounts, or vault SDK implementations to verify dynamic credential retrieval.
- Examine CI/CD pipeline configurations (e.g., Jenkins pipelines, GitHub Actions workflows, GitLab CI files) to confirm secrets are referenced through vault integrations or masked variables rather than plaintext values.
- Interview development and DevOps staff to validate understanding of secret vaulting requirements, onboarding processes for new applications, and procedures for remediating discovered hardcoded secrets.
Where this control is tested