hardMultiple ChoiceObjective-mapped
Google ACE Practice Question: A security team discovers that a service account…
A security team discovers that a service account key was accidentally committed to a public GitHub repository 48 hours ago. What should be the immediate steps to remediate this incident?
⚠ Common exam trap
Google Cloud often tests the misconception that rotating a key (generating a new one while keeping the old active) is sufficient, but the trap is that the old key remains valid and must be explicitly deleted to fully remediate a public leak.
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
✓
Delete the leaked key immediately, audit Cloud Audit Logs for unauthorized activity using the key, then create a new key or switch to keyless authentication
The immediate priority is to revoke the compromised key's access by deleting it, which invalidates it instantly. Auditing Cloud Audit Logs is essential to detect any unauthorized usage that occurred during the 48-hour exposure window. Finally, creating a new key or switching to keyless authentication (e.g., workload identity federation) restores secure access without relying on long-lived static credentials.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Rotate the service account key to generate a new one, keeping the old key active briefly for transition
Why it's wrong here
Rotating the key while keeping the old key active for transition leaves the leaked credential valid during that entire period, which defeats the purpose of containment. In GCP, a proper rotation means creating a new key and immediately deleting the compromised one, not overlapping their validity. Because the leaked key has already been exposed, an attacker can use it to mint access tokens until it is deleted, so the only safe action is to delete the old key right now, then create a replacement key to restore service.
- ✓
Delete the leaked key immediately, audit Cloud Audit Logs for unauthorized activity using the key, then create a new key or switch to keyless authentication
Why this is correct
Deleting the compromised service account key immediately revokes the attacker's primary authentication credential, effectively cutting off their direct API access through that key. After deletion, audit Cloud Audit Logs—specifically the Data Access and Admin Activity logs—to determine whether the key was used to call any GCP APIs, identify the scope of exposure, and check for unusual patterns such as token creation or IAM changes. Then issue a new key if the workload still requires a long-lived credential, or better, eliminate static keys entirely by adopting keyless authentication such as Workload Identity Federation, which binds short-lived credentials to the workload's identity.
- ✗
Change the service account's display name and email to invalidate the leaked key
Why it's wrong here
Changing the service account's display name or email is purely a metadata operation that does not affect the underlying cryptographic key material or the key's validity. The leaked key is an RSA private key that remains bound to the service account's ID; it will continue to authenticate as the service account until it is explicitly deleted or rotated. Moreover, the service account's email is immutable and cannot be changed, and an attacker who still holds the key can simply ignore the new display name and keep calling the IAM generateAccessToken API to obtain fresh tokens.
- ✗
Remove all IAM roles from the service account to deny all actions until the investigation completes
Why it's wrong here
Removing IAM roles from the service account temporarily prevents the key from authorizing actions, but the leaked key still exists and can be used to request OAuth2 tokens whenever roles are re-added. The secret is compromised, not just the permissions; as long as the key remains, it is a credential that an attacker can present to obtain any future access granted to that service account. A proper first response must delete or invalidate the key itself, with IAM role removal as an additional containment measure, not a substitute.
Go deeper
Related to this question
Learn chapter
Google Cloud Platform Overview
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.
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.
About these practice questions
Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE 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 ACE exam.