DevOps Engineer interview question · Most asked
A production API credential was committed to Git. What do you do immediately, and how do you stop it happening again?
Scenario Asked in DevOps Engineer · Site Reliability Engineer (SRE) interviews
Summary
Treat it as compromised from the moment it was pushed: revoke or rotate the credential first, then check the provider's logs for misuse, and only then clean the repository. Removing the commit isn't enough, because clones, forks, CI logs and caches keep it.
Longer Answer
Now
- Rotate or revoke the credential (follow the zero-downtime rotation if production depends on it).
- Review access logs for the credential since the commit time; if misused, escalate as a security incident.
- Remove it from the repository (
git filter-repoor BFG, force-push, ask collaborators to re-clone) and ask the hosting provider to purge cached views if the repo was public.
Prevent
- Pre-commit hooks (gitleaks, detect-secrets) and server-side push protection (GitHub secret scanning push protection).
- Secrets only in a secret manager; local development uses
.envfiles that are git-ignored, or short-lived credentials. - Short-lived credentials (OIDC, IAM roles) so a leak expires on its own.
- A blameless review: how did the secret reach the code, and what made that easy?
Key Points
- Rotate first; history rewriting comes later.
- Check logs for misuse.
- Clones and caches keep old commits.
- Push protection and pre-commit scanning.
- Short-lived credentials limit future leaks.
Explanation
What interviewers look for
Correct priority order (revoke before cleanup) and layered prevention.
More DevOps Engineer questions
- Every deployment produces a burst of 502s. What do you check?
- Design an end-to-end CI/CD and GitOps setup for 50 microservices, with testing, security scanning, artifact management and production deployment.
- Pods keep restarting with OOMKilled under load. How do you investigate and fix it?
- What happens when you type a URL into a browser and press Enter?
- Your ecommerce site runs 30 microservices on Kubernetes. After a deployment, customers start getting HTTP 503 errors. How do you investigate and resolve it?
- Your Kubernetes-based ecommerce site goes down during peak traffic. Walk through your first 15 minutes.
- A rollback after a release made the outage worse because the database had already been migrated. How do you design releases so rollbacks are always safe?
- After a release, checkout becomes slow. How do you use traces, JVM metrics, connection pool metrics and database monitoring to find the cause?