Cloud Digital Leader Trust and security with Google Cloud Practice Question
A developer accidentally commits an application's Google Cloud service account key to a public GitHub repository. The key is valid and grants access to production resources. What is the correct immediate response?
⚠ Common exam trap
Many exam-takers think removing the key from the repository (Option A) is sufficient, but they overlook that the key remains valid in Google Cloud and can still be used by anyone who already obtained it.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Immediately revoke/delete the exposed service account key in Google Cloud IAM, review Cloud Audit Logs for unauthorized access, and generate a new key distributed through secure channels
The immediate priority is to invalidate the exposed credential to prevent unauthorized access to production resources. Revoking the key in Google Cloud IAM ensures it can no longer be used for authentication, while reviewing Cloud Audit Logs helps identify any potential misuse. Generating a new key and distributing it securely restores access for legitimate applications.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Delete the commit from GitHub history using git rebase; the key is safe once removed from the repository
Why it's wrong here
GitHub history cannot reliably be purged — the data may already be cached, indexed, or copied. Even if removed from history, the key must be treated as compromised because it was publicly visible. Deletion from Git history is not a remediation; revocation of the key is.
- ✓
Immediately revoke/delete the exposed service account key in Google Cloud IAM, review Cloud Audit Logs for unauthorized access, and generate a new key distributed through secure channels
Why this is correct
This is the complete correct response: (1) Revoke the key immediately to stop any ongoing unauthorized access. (2) Review Admin Activity and Data Access audit logs to determine if the key was used after exposure. (3) Issue a new key through a secure distribution channel (ideally Secret Manager, not environment variables). Time to revocation is critical.
- ✗
Change the service account's permissions to read-only to limit the damage from potential misuse
Why it's wrong here
Reducing the service account's IAM roles to viewer or read-only narrows what an attacker can do after authenticating with the stolen key, but it does nothing to stop the authentication itself — the key remains cryptographically valid. An attacker who obtained the private key can still impersonate the service account and invoke any allowed method; moreover, legitimate workloads breaking due to permission changes creates urgency to revert, potentially leaving the key exposed longer. The only proper control is to delete the key as soon as exposure is known, then reissue a new key via Secret Manager and redeploy, because a leaked credential is always treated as compromised regardless of subsequent authorization changes.
- ✗
Send an internal email informing the security team and wait for their guidance before taking any action
Why it's wrong here
Pausing for internal escalation before revocation is operationally indefensible: authentication with the exposed key is already possible for anyone who extracted it, and IAM does not retroactively invalidate credentials based on access patterns. The security team's guidance can be solicited in parallel, but the immediate, unambiguous act of deleting the key in the IAM console or via the API (projects.serviceAccounts.keys.delete) must never be deferred for process reasons. Any delay, even minutes, extends the risk window for an attacker to call Cloud APIs, exfiltrate data, or pivot to other resources using the compromised identity.
Go deeper
Related to this question
Learn chapter
Cloud Digital Transformation
Key term
Cloud Audit Logs
Cloud Audit Logs are a record of actions taken by users, services, and resources inside a cloud environment, capturing who did what, when, and from where.
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
About these practice questions
One of 829 original GCDL practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This GCDL practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the GCDL exam.