Phase 4 · Secrets Management + DLP · Lesson 3 of 3
Exercise
·
25 min
·
+20 pts
Hardcoded secrets are the single most common finding you'll meet in this entire phase — and the remediation is a project, not a one-line fix. It involves finding every secret (including the ones buried in git history), rotating them all (they must be assumed compromised), moving them into a managed store, changing how the application authenticates so it has no bootstrap secret of its own, and preventing recurrence. Do it in the wrong order and you either break production or leave live credentials exposed.
In this exercise you'll plan the migration for Beacon Health, a regulated SaaS whose codebase has accumulated secrets the usual way. First you'll work through the sequencing decisions, then you'll write the full remediation plan an engineering team can execute.
Running the first secret-scan across the whole repo
Beacon's repo audit finds: a database password and an AWS access key in config.py; a Stripe secret key in a .env file that is committed to the repo; an internal API token in the CI pipeline config; and — discovered later — an old database password still present in git history from two years ago. The app currently reads all of these from config files at startup.
Quick check
The team is eager to move secrets into AWS Secrets Manager and update the code. What must happen BEFORE (or alongside) the migration, and why?
Quick check
The old database password exists only in git history now, not in the current code. How should you handle it?
Quick check
After migration, the app will fetch secrets from AWS Secrets Manager at runtime. An engineer plans to store a 'master' Secrets Manager API token in an environment variable so the app can authenticate. What's wrong, and what's the fix?
Quick check
The migration is done. How do you keep secrets from creeping back into the codebase?
Now translate the finding into a full remediation plan. Sequence it correctly (rotate + migrate together, fix the bootstrap identity, prevent recurrence) and name the evidence for each step.
Exercise
~30 min
Translate this audit finding into a technical remediation plan
SOC 2 Type II Finding
Hardcoded credentials in source code and CI configuration
ID:
CC6.1-2026-031
Criterion:
CC6.1 — Logical access controls (credential management)
Severity:
Critical
A secret-scan of the application repository found multiple hardcoded credentials: a production database password and an AWS access key in config.py, a Stripe live secret key in a committed .env file, and an internal API token in the CI pipeline configuration. Git history additionally contains a database password committed approximately two years ago. The application reads these credentials from config files at startup. There is no secrets manager in use and no secret scanning in CI.
Auditor Notes
Credentials grant access to production data stores and a payment provider. The repository is private but has been cloned by multiple developers and a CI system. Management cannot rule out exposure. No evidence of misuse was identified, but access logging on the affected systems is limited.
Write your remediation plan in YAML below. Fill in every field — replace all placeholder comments.
A secrets-remediation project always runs in the same order: rotate first (the leaked value is the live risk, and it's worthless once rotated), migrate the new secrets into a managed store while fixing the bootstrap identity so the app authenticates with a platform identity rather than another stored secret, and prevent recurrence with automated scanning and push protection that catch mistakes at commit time. Sequencing is the skill: migrating before rotating leaves live secrets exposed, and storing a master token to reach the vault just relocates the problem. Name the evidence for each step — rotation records, the secrets inventory and access logs, the code diff, a blocked-commit sample — and you've turned the phase's most common finding into a closed, auditable control.
This is the last lesson of the Data Protection phase. You can now trace any data-protection requirement — at rest, in transit, in storage, in backups, in credentials, in motion out the door — to a specific cloud control and the evidence that proves it operates. That translation, from "protect the data" to "here is the setting, the policy, and the report," is the core of the GRC Engineer's craft.