Cyber Attacks and Defense in Practice
A developer accidentally committed a configuration file containing an API key for a cloud service to a public Git repository. On noticing, the developer immediately committed a change deleting the file. Which of the following is the most appropriate response after this?
- AA deletion has been committed, so nobody can see the key any more and nothing further needs to be done
- BIt remains in the history and may already have been harvested, so revoke the key at once, replace it with a new one and check the usage records for misuse
- CRenaming the repository makes the old contents published under the previous name inaccessible, so the leaked key can continue to be used as it is
Show answer and explanation
Answer: B. It remains in the history and may already have been harvested, so revoke the key at once, replace it with a new one and check the usage records for misuse
In Git, even after a change deleting a file is committed, earlier versions remain in the history and anyone can retrieve them. Public repositories are scanned automatically within a short time by programs looking for credentials, so a key should be treated as leaked from the moment it was published. The most important step is to revoke the key and replace it with a new one; after that, the usage records are checked and, if necessary, the key is also removed from the history. To prevent recurrence, credentials are kept in a secrets management service and a mechanism that detects secrets before committing (secret scanning) is used.
- A. Old versions remain in the history, and the key may already have been harvested while it was public.
- B. Correct. First revoke and replace the key, then check whether it has been misused.
- C. Renaming does not erase contents that have already been copied, and it does not change the fact that the key leaked.
Continue: 9 more Cyber Attacks and Defense in Practice questions