Interview › Security & DevSecOps
What do you do if a secret has already been committed and pushed? [Intermediate]
Answer
If a secret has been committed and pushed, treat it as compromised. Immediately revoke or rotate it, assess access logs for misuse, remove it from active code/config, purge history only as cleanup, and notify affected owners. Deleting the commit is not enough.
Technical explanation
Assume the secret may have been copied by clones, forks, CI logs, caches, or dependency mirrors.
Rotation should happen before or at least alongside history cleanup so the exposed value is no longer valid.
After remediation, add detection rules and preventive controls to avoid recurrence.
Hands-on example
Incident steps: 1) Identify secret type and scope. 2) Revoke/rotate in the source system. 3) Search logs for use after exposure. 4) Remove secret from repo and CI variables. 5) Use git-filter-repo/BFG if needed. 6) Add gitleaks and secret-manager integration.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Security & DevSecOps interview questions
- What is workload identity, and how does it remove static credentials? [Intermediate]
- What is OPA, and what is the Rego language used for? [Intermediate]
- What is vulnerability management as a lifecycle (discover, prioritise, remediate, verify)? [Intermediate]
- How do you apply least privilege to service-to-service communication (e.g., with Istio mTLS)? [Intermediate]
- What is secrets management, and how does HashiCorp Vault work at a high level? [Intermediate]
- How do you reduce the noise of thousands of vulnerability findings? [Intermediate]
- What is encryption at rest versus in transit, and how do you ensure both? [Advanced]
- What is the difference between a CVE, a CVSS score, and exploitability (EPSS/KEV)? [Basic]