An integration engineer must grant a third-party application service account access to publish metric events to a single Cloud Pub/Sub topic named `events-telemetry` within the GCP project `analytics-prod-88`. The application must not be granted permissions to manage Pub/Sub topics or publish messages to any other topics. Which configuration adheres to the principle of least privilege?
- Grant the Pub/Sub Publisher role (roles/pubsub.publisher) to the service account directly on the `events-telemetry` topic resource.Answer
- BGrant the Editor role (roles/editor) to the service account on the `analytics-prod-88` project.
- CGrant the Pub/Sub Publisher role (roles/pubsub.publisher) to the service account at the parent Organization level.
- DGrant the Pub/Sub Admin role (roles/pubsub.admin) to the service account on the `analytics-prod-88` project.
Answer
Grant the predefined Pub/Sub Publisher role (roles/pubsub.publisher) directly on the specific topic resource.
Granting the predefined Pub/Sub Publisher role (`roles/pubsub.publisher`) directly on the target Pub/Sub topic resource enforces the principle of least privilege by scoping permissions strictly to the single topic required.
Step-by-Step Solution
Key Concept
Applying Least Privilege with Resource-Level IAM Roles