CS FundamentalsHardProduct-company security interview

A file config.env holding a live API key was committed and pushed three weeks ago. The developer now runs git rm --cached config.env, adds it to .gitignore and pushes. Which statement is correct?

  1. A. The key is still in the repository history, so it must be revoked and rotated; rewriting history is optional extra clean-up
  2. B. The key is now gone from the repository everywhere
  3. C. git rm --cached also deleted the file from the developer's disk
  4. D. The key is safe because .gitignore applies retroactively

Correct answer: A. The key is still in the repository history, so it must be revoked and rotated; rewriting history is optional extra clean-up

git rm --cached only stops tracking from now on and keeps the local file; every earlier commit still contains the key, and clones already have it. A leaked secret must be treated as compromised and rotated.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic