GH-100 practice question 9 of 15
What is the first step when sensitive data is accidentally pushed to a public GitHub repository?
Full set: 65 questionsWhen sensitive data like credentials or API keys are exposed in a public repository, they must be considered compromised immediately. The first and most critical action is to invalidate the exposed secrets. This prevents malicious actors who may have already cloned, forked, or scraped the repository from using them. Revoking the credentials at their source (e.g., the service provider) is the only way to mitigate the immediate threat and prevent unauthorized access or damage. Steps to clean the repository's history are secondary and do not address the fact that the secret has already been exposed.
B. Force push a commit removing the data: This does not remove the data from the repository's history, nor does it invalidate the secret, which is already considered compromised.
C. Open an issue to inform users: This is a communication step that should occur after the immediate threat is contained by revoking the credentials. Informing users first could accelerate misuse.
D. Delete the repository: This is a destructive action that does not invalidate the exposed credentials and fails to address the core security risk from potential clones or forks.
1. GitHub Docs, "Removing sensitive data from a repository." In the section "Preventing unauthorized access," the documentation explicitly states: "As soon as you commit a secret to a repository, you should consider the secret compromised." It then lists the first recommended actions as revoking the specific type of credential, such as a personal access token, SSH key, or other API keys, before proceeding to remove the file from the repository's history.
2. Microsoft Docs, "Credential scanning - Azure DevOps." In the section on "Remediation," the official guidance for handling an exposed credential is: "The first step is to immediately rotate the exposed credential. Once that's done, you can revoke the old credential." This prioritizes invalidation over any other action.
3. Carnegie Mellon University, Software Engineering Institute, "SEI CERT C++ Coding Standard," STR51-CPP. Do not leak sensitive information. While focused on C++, the principle is universal. The remediation section for information exposure incidents emphasizes immediate invalidation of compromised secrets as the primary containment step. (Refer to general incident response principles for information exposure).
Keep practicing
Take the free GH-100 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GH-100 practice questions
- Question 1Your organization is implementing team synchronization. Which of the following should you…
- Question 2Why would someone choose to configure a security policy?
- Question 3Which events from the audit log are exposed by the GraphQL API? Each answer presents a co…
- Question 4You are using GitHub-hosted runners and need to securely deploy to an internal system. Th…
- Question 5You have subscribed to GitHub Premium Support, and you need to submit a support ticket. G…
- Question 6What distinguishes Enterprise Managed Users (EMUs) from standard GitHub accounts?
