Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Security Engineer practice bank has 1,343 more like it. Try 10 free: instant score, no account.
A security architect is configuring Workload Identity Federation to allow external CI/CD pipelines running on a third-party OpenID Connect (OIDC) identity provider to access Google Cloud resources without using service account keys.
The incoming OIDC ID token contains the following claims:
sub: A unique subject string (under 127 bytes)repository_owner: The organization owning the repository (e.g., example-org)ref: The branch reference (e.g., refs/heads/main)environment: The deployment target environment (e.g., production)The security requirements are:
example-org targeting production can exchange tokens for Google Cloud credentials.Which configuration strategy should the architect implement?
This approach uses traditional user-managed service account keys stored in Secret Manager, requiring external CI/CD pipelines to authenticate to Google Cloud and retrieve the private key JSON file during pipeline execution.
The external environment was entirely unable to produce OIDC or SAML assertion tokens and was restricted to legacy tools that only accept static private key credentials.
--attribute-mapping="google.subject=assertion.sub,attribute.owner=assertion.repository_owner,attribute.env=assertion.environment", set the --attribute-condition="assertion.repository_owner == 'example-org' && assertion.environment == 'production'", and grant IAM roles to the principal set principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/attribute.env/production.Workload Identity Federation allows external workloads (such as third-party CI/CD runners, Kubernetes clusters, or multi-cloud services) to authenticate to Google Cloud by exchanging external OIDC or SAML assertions for short-lived Google Cloud federated tokens. Attribute mappings define how incoming token claims (assertion.CLAIM_NAME) map to standard Google attributes (google.subject) and custom attributes (attribute.CUSTOM_NAME). Attribute conditions use Common Expression Language (CEL) expressions evaluated by Google Cloud's Security Token Service (STS) to validate and filter assertions before issuing any federated credentials.
--attribute-condition="assertion.repository_owner == 'example-org' && assertion.environment == 'production'" ensures that the Workload Identity Pool Provider evaluates the incoming OIDC token assertions upon receipt. If the workload is not from example-org or is not deploying to production, STS immediately rejects the exchange request and refuses to issue a token.--attribute-mapping flag maps google.subject=assertion.sub (ensuring unique principal identity tracking under 127 bytes) and creates custom attributes attribute.owner and attribute.env from assertion.repository_owner and assertion.environment respectively.principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/attribute.env/production ensures that any authenticated identity carrying the mapped attribute.env value of production from that pool receives the necessary IAM permissions without managing long-lived keys.google.subject attributes appear directly in Cloud Audit Logs to provide traceability for every external workload action.Evaluating attribute conditions at the provider level minimizes security exposure and computational overhead by rejecting untrusted pipelines immediately. Leveraging mapped custom attributes in IAM principal sets ensures a least-privilege access model without creating individual service accounts or keys for each repository.
--attribute-mapping="google.subject=assertion.sub+assertion.repository_owner+assertion.environment", omit custom attribute mappings, and grant IAM roles directly to the entire pool using principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/*.This option concatenates multiple incoming assertions into the google.subject field, omits discrete custom attribute mappings, and grants broad IAM roles to all identities within the Workload Identity Pool.
google.subject increases the risk of exceeding the 127-byte limit for google.subject, which causes token exchange calls to fail with an invalid_request error from SecurityTokenService.principalSet://.../workloadIdentityPools/POOL_ID/* grants access to every authenticated workload in the entire pool, ignoring the requirement to grant access specifically to production workloads.attribute.owner and attribute.env as discrete custom attributes prevents IAM policies from enforcing fine-grained principal set bindings like /attribute.env/production.google.subject value has a strict hard limit of 127 bytes./*) bypass granular least-privilege access controls.All workloads in the identity pool required identical, uniform permissions across all environments and the concatenated subject string was guaranteed to remain under 127 bytes.
--attribute-mapping="attribute.owner=assertion.repository_owner,attribute.env=assertion.environment", omit the provider --attribute-condition, and enforce the filtering logic exclusively using IAM Conditions on individual service accounts.This option configures custom attribute mappings on the Workload Identity Pool Provider without defining the required google.subject mapping, omits the provider-level attribute condition, and attempts to restrict access solely through IAM Conditions on service accounts.
google.subject mapping: Workload Identity Federation strictly requires a target mapping for google.subject. An attribute mapping configuration that omits google.subject is invalid and will be rejected by the API during provider creation.--attribute-condition configured on the Workload Identity Pool Provider, any external workload holding a valid signature from the OIDC IdP can exchange its token for a federated Google Cloud token. Even if IAM policies later block access to specific resources, the token exchange itself succeeds, failing the requirement to filter and reject unauthorized tokens at the provider boundary.google.subject is a mandatory attribute in Workload Identity Federation mappings.The identity provider did not support standard subjects and the organizational architecture required all external workloads to obtain tokens but dynamically evaluate resource-level permissions per request using IAM resource tags.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated