Interview Prep/DevSecOps/Pipeline Security Scanning

Gitleaks flags an AWS access key in a pull request. The developer says it is a test key. What do you do?

BeginnerScenarioPipeline Security Scanning
Answer

Situation read → I never trust "it is a test key" until I verify it. Anything shaped like AKIA... is live until proven otherwise.

What I'd do →

  1. Block the merge and keep the PR open.
  2. Check whether the key is valid: aws sts get-caller-identity with that key from a trusted workstation, or ask the cloud team to look it up in IAM.
  3. If live, deactivate it right away: aws iam update-access-key --access-key-id AKIA... --status Inactive --user-name <user>.
  4. Remove the key from the branch history, not just the last commit, then rotate and move the value to a secret store.
  5. Add a fake-looking placeholder or an allowlist entry in .gitleaks.toml only if it is truly a dummy.

Why → A key pushed to a remote can be scraped within minutes, even on private repos that later get exposed.

Interview tip → Mention that rotation matters more than deleting the commit.

All DevSecOps questions Roadmap: Security in the pipeline

More on Pipeline Security Scanning