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?
- A. The key is still in the repository history, so it must be revoked and rotated; rewriting history is optional extra clean-up
- B. The key is now gone from the repository everywhere
- C. git rm --cached also deleted the file from the developer's disk
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- How many of these statements about Git's object model are correct? 1. Two files with identical content in different folders are stored as…
- You pushed commit C to a shared branch, then ran git commit --amend to fix its message and tried git push again. What happens and why?
- main has A-B-X, where X was committed after feature branched from B; feature has C-D-E. How many commits are reachable from main after…
- In GitFlow, a critical bug is found in production (main) while develop holds unreleased work. What is the standard handling?
- A team practising trunk-based development wants to merge a half-built feature into main daily without exposing it to users. What makes…
- You have 2 local commits on main and the remote main has 3 new commits. What does git pull --rebase do?