Courseiva
mediumMultiple ChoiceObjective-mapped

Google ACE Practice Question: A developer accidentally committed a service…

A developer accidentally committed a service account key JSON file to a public GitHub repository. The key was valid for a service account with broad Editor permissions. What should you do FIRST?

⚠ Common exam trap

Google Cloud often tests the misconception that removing the file from Git history (Option A) is sufficient, but the key remains valid and usable by anyone who already has it, so revocation must come first.

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 delete or disable the service account key in the Cloud Console or via gcloud.

The immediate priority is to revoke the exposed credential to prevent unauthorized access. Deleting or disabling the service account key in the Cloud Console or via `gcloud iam service-accounts keys delete` ensures the key is invalidated within minutes, stopping any attacker from using it to authenticate with Google Cloud APIs. This aligns with the principle of least privilege and incident response best practices: contain the breach before remediation.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Remove the committed file from Git history using `git filter-branch` or BFG Repo Cleaner.

    Why it's wrong here

    Rewriting Git history with filter-branch or BFG removes the key from future visible commits, but it does nothing about the key that was already exposed — secret scanners or anyone who cloned the repo may already have it. The key remains cryptographically valid, so an attacker can still use it to authenticate as the service account. Revocation is the only way to stop active misuse; history rewriting is a slow, error-prone follow-up cleanup step that should never substitute for immediately invalidating the credential.

  • Immediately delete or disable the service account key in the Cloud Console or via gcloud.

    Why this is correct

    Immediately deleting or disabling the service account key in the Cloud Console or with gcloud revokes the credential at the source, making it invalid for all OAuth token requests regardless of who possesses it. This is the highest-priority action because it stops ongoing unauthorized access in seconds and does not depend on how widely the key was distributed. After this containment step, you can investigate the exposure, rotate remaining keys, and audit usage logs without an active threat.

  • Make the GitHub repository private to hide the exposed key.

    Why it's wrong here

    Making the GitHub repository private limits who can see the key going forward, but it cannot undo a prior public exposure: the key may already be cached in audit logs, third-party mirrors, or attacker databases. Because the service account key is still active, anyone who obtained a copy before the repo was locked down can keep impersonating the service account. The correct containment action is to revoke the key itself, not to hide the artifact.

  • Reduce the service account's permissions to limit the blast radius.

    Why it's wrong here

    Reducing the service account's IAM roles narrows what an attacker can do with the compromised key, but the key itself still works for the reduced permissions set. This is a useful damage-limitation step after revocation, but it leaves the credential valid for direct token requests via the Google OAuth 2.0 endpoint. The first priority must be to invalidate the key entirely, because permission changes are reversible and do not terminate existing sessions or cached credentials.

About these practice questions

This ACE question is part of Courseiva's 769-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.