Course outline

Google Cloud / Advanced: Governance, Reliability, and Architecture / Lesson 21

Review workload identity federation trust

Trace external identity claims, attribute mapping and IAM authorization for a federated workload.

About 19 min read20 worked examples20 practice exercisesContent reviewed
On this page

Lesson goals

  • Explain token exchange and attribute mapping.
  • Distinguish provider admission from resource authorization.
  • Test an allowed and denied identity in an isolated lab.
  • Trace external claims, mapped principals and resource authorization separately.
  • Evaluate mutable attribute risk and test intended and neighboring identities.

Define the trust chain

Workload Identity Federation lets eligible external workloads obtain Google Cloud credentials without distributing a service account key. An external identity provider issues a credential, which is exchanged through Google Security Token Service. The provider configuration, attribute mapping and IAM policy each contribute to the trust boundary. The records here are fictional and no token exchange or cloud operation occurs.

Identify the external claims

The first record represents an invented issuer, subject, environment and audience. Verify the real issuer, audience and claims against the identity provider’s documentation before mapping them. Choose stable attributes that the workload cannot arbitrarily change. A human-readable environment label is not sufficient proof of identity unless the issuer and claim controls make it trustworthy.

yaml Synthetic external assertion
external_issuer: synthetic-identity-provider
subject: workload-123
environment: lab
audience: approved-provider

The record is not a token and contains no credentials.

Map and restrict identity

Attribute mappings derive Google token attributes from the external assertion, and a provider condition can restrict accepted identities. The second record expresses an illustrative mapping and condition without presenting deployable policy. A change to mappings or conditions can change who is admitted, so review its effects on all existing bindings and test both intended and neighboring identities.

yaml Synthetic mapped identity
mapped_subject: workload-123
condition: environment-is-lab
target_resource: synthetic-project
authorization: separately-reviewed

The record describes a review hypothesis, not an IAM binding or token result.

Authorize the target separately

A credential accepted by the federation provider is not automatically authorized for every Google Cloud resource. Review the mapped principal or principal set, target resource and role binding, including any service-account impersonation path in the actual design. Confirm the correct project and operation. Avoid broad grants to work around an unclear mapping or denied request.

Verify the full path

In an authorized lab, test an intended external identity and a nonmatching identity with synthetic resources. Correlate sanitized issuer, mapped principal, target and result without storing tokens. Confirm the intended request succeeds and the neighboring request is denied.

Trace the external identity through the trust chain

Workload Identity Federation lets supported external workloads exchange credentials for short-lived Google credentials under a configured pool and provider. Review the external issuer and assertion, provider configuration, attribute mapping and conditions, mapped principal, and the eventual resource authorization as distinct steps. Depending on the design, a federated principal can receive direct access or impersonate a service account before accessing a resource. These fictional records do not issue or exchange tokens and do not query Google Cloud. A successful exchange is evidence for that step, not a blanket permission to use every resource.

For example, a deployment pipeline may obtain an external assertion, exchange it through a provider, impersonate a service account and then read an object. Record the principal and decision at each transition. If the exchange succeeds but the object read is denied, the evidence points to a later boundary that needs review; it does not justify changing the provider condition blindly. The same method works for direct resource access, where the impersonation step is absent.

Choose stable, controlled attributes

Attribute mapping translates external claims into Google attributes that can identify or group principals for policy. A provider condition can restrict which assertions are accepted. Determine who can change each external claim, whether it is unique and stable, and how reassignment or renaming affects bindings. If a user can edit a claim used to select a privileged principal set, that claim may let an unintended workload match the binding. Prefer an appropriately controlled stable identifier where supported and review the exact provider and identity source. A friendly label alone is not proof of ownership or trustworthiness.

Separate acceptance from resource access

An accepted assertion or successful token exchange does not establish authorization on a bucket, database or service account. Identify the mapped principal, requested operation, exact resource and applicable IAM binding and conditions. If the design uses service-account impersonation, review permission to impersonate that account separately from the account’s permission on the target. A denial after exchange calls for investigation of the principal and target path, not automatic expansion of the provider condition. Keep identity, impersonation and resource scopes visible in the decision record.

Review trust changes and failure modes

A mapping or condition change can alter which external workloads match existing bindings even if the target policy is unchanged. Compare old and proposed claim values, provider condition, mapped principal and affected bindings before approval. Account for a shared issuer that serves multiple tenants or repositories; issuer recognition alone may not establish the intended workload. Plan an owner, rollback and a negative test for a neighboring identity. Do not store assertions, access tokens or private credentials in tickets. A proposed configuration and an observed exchange are separate evidence states.

Test the full path with bounded evidence

In an authorized isolated environment, test an intended external workload and a neighboring workload that should be rejected or lack access, using the configured trust and relevant policy. Test resource authorization separately from exchange and, where applicable, impersonation. Record sanitized issuer, mapped principal identifier, target, operation, timestamps and outcomes without bearer tokens. If a test is blocked, mark it unverified. A successful test describes its assertion and configuration at that time; it does not prove every future claim or external identity is safe. Repeat appropriate checks after a mapping, provider or binding change.

Keep the reviewed trust configuration, test inputs and observed outcomes linked by provider, target and time. If an external test runner is unavailable, assign an owner and keep the test blocked rather than recording a rejection. After an approved mapping change, repeat both the intended and neighboring identity cases and inspect target authorization separately. Preserve only sanitized identifiers and the conclusions needed for review, never the bearer assertion or access token itself.

20 worked examples

1. Exchange versus access

Problem: Does successful exchange establish the bucket read?

  1. The exchange succeeded, but the resource request was denied and its policy is uninspected.
  2. Review the mapped principal, bucket, read operation and applicable IAM binding.
text Synthetic federation trust record
exchange=success
mapped principal=workload-A
bucket read=denied
IAM binding=not inspected

This fixture issues no token and makes no cloud request.

Expected result: Review the mapped principal, bucket, read operation and applicable IAM binding.

Why this result follows: Token exchange and resource authorization are separate decisions.

2. Mutable claim

Problem: Is this claim a safe selector for a privileged binding?

  1. A user can change the attribute used to select the privileged binding.
  2. Review a controlled stable attribute and affected bindings before relying on it.
text Synthetic federation trust record
mapped attribute=team-label
external user can edit team-label=yes
binding=privileged principal set

This fixture issues no token and makes no cloud request.

Expected result: Review a controlled stable attribute and affected bindings before relying on it.

Why this result follows: An attacker-controlled selector can map an unintended identity into a privileged set.

3. Wrong target

Problem: Does a grant on bucket A establish access to bucket B?

  1. The requested bucket differs from the recorded grant scope.
  2. Inspect B’s applicable policy and the exact operation.
text Synthetic federation trust record
mapped principal=workload-A
grant scope=bucket-A
requested resource=bucket-B

This fixture issues no token and makes no cloud request.

Expected result: Inspect B’s applicable policy and the exact operation.

Why this result follows: A grant on one resource does not automatically authorize another.

4. Impersonation boundary

Problem: Does provider acceptance establish service-account impersonation?

  1. The provider accepted the assertion, but impersonation permission is not recorded.
  2. Review the account policy and required impersonation permission separately.
text Synthetic federation trust record
provider condition=accepted
principal permission on service-account-A=unknown
requested flow=impersonate A

This fixture issues no token and makes no cloud request.

Expected result: Review the account policy and required impersonation permission separately.

Why this result follows: Provider acceptance does not itself establish downstream account authority.

5. Account resource access

Problem: Does successful impersonation prove the account can read the object?

  1. The credential path succeeded, but the target object permission is unexamined.
  2. Inspect the account’s applicable resource authorization and test the intended read.
text Synthetic federation trust record
impersonation=success
service-account object permission=unknown
object read=not tested

This fixture issues no token and makes no cloud request.

Expected result: Inspect the account’s applicable resource authorization and test the intended read.

Why this result follows: Acting as an account and the account’s resource permission are distinct boundaries.

6. Shared issuer

Problem: Does recognizing the issuer identify the intended repository?

  1. The issuer serves more than one possible workload in this model, and the workload claim is absent.
  2. Review the mapped repository or stable workload attribute and provider condition.
text Synthetic federation trust record
issuer=shared-provider
repository claim=not inspected
provider condition=unknown

This fixture issues no token and makes no cloud request.

Expected result: Review the mapped repository or stable workload attribute and provider condition.

Why this result follows: Issuer recognition alone does not distinguish workloads under a shared issuer.

7. Mapping change

Problem: Can a mapping change affect an existing IAM binding?

  1. The same binding selector may now receive values from a different external claim.
  2. Review which workloads match before and after the proposed mapping.
text Synthetic federation trust record
old mapping=attribute.team from claim-A
new mapping=attribute.team from claim-B
IAM binding=unchanged

This fixture issues no token and makes no cloud request.

Expected result: Review which workloads match before and after the proposed mapping.

Why this result follows: Changing mapped attributes can change the principals selected by an unchanged binding.

8. Neighbor test

Problem: Does a successful intended workload test prove a neighbor is excluded?

  1. Only the intended positive case was observed; the neighboring case is absent.
  2. Review the condition and perform an authorized negative test for B.
text Synthetic federation trust record
workload-A exchange=success
workload-B negative test=not run
condition=not inspected

This fixture issues no token and makes no cloud request.

Expected result: Review the condition and perform an authorized negative test for B.

Why this result follows: A positive result does not demonstrate exclusion of another identity.

9. Bearer assertion

Problem: Should a full external assertion be attached to a public ticket?

  1. The proposed evidence contains bearer material beyond the sanitized review need.
  2. Do not publish it; follow exposure response if already disclosed and retain sanitized context.
text Synthetic federation trust record
ticket=public
proposed evidence=complete assertion
needed evidence=issuer, mapped principal, time

This fixture issues no token and makes no cloud request.

Expected result: Do not publish it; follow exposure response if already disclosed and retain sanitized context.

Why this result follows: A bearer assertion can be sensitive and is unnecessary for ordinary review evidence.

10. Blocked exchange test

Problem: Does an unavailable test runner prove the provider rejected the assertion?

  1. No exchange request was made.
  2. Record the test as blocked and keep provider behavior unverified.
text Synthetic federation trust record
test runner=unavailable
exchange request=not sent
result=none

This fixture issues no token and makes no cloud request.

Expected result: Record the test as blocked and keep provider behavior unverified.

Why this result follows: An unrun test has no observed exchange outcome.

11. Condition mismatch

Problem: Does the observed workload meet this synthetic provider condition?

  1. The repository identifier differs from the condition despite the accepted issuer.
  2. The modeled condition does not match; verify the intended workload and configuration.
text Synthetic federation trust record
provider condition=repository_id 123
observed repository_id=456
issuer=accepted

This fixture issues no token and makes no cloud request.

Expected result: The modeled condition does not match; verify the intended workload and configuration.

Why this result follows: A trusted issuer alone does not satisfy a different workload condition.

12. Attribute collision

Problem: Can these two external identities be distinguished by the mapped value?

  1. Both workloads map to the same value selected by the binding.
  2. Review whether both should match and choose a more discriminating controlled attribute if needed.
text Synthetic federation trust record
external workload-A mapped team=build
external workload-B mapped team=build
privileged binding selects team=build

This fixture issues no token and makes no cloud request.

Expected result: Review whether both should match and choose a more discriminating controlled attribute if needed.

Why this result follows: A selector cannot distinguish identities that map to the same value.

13. Renamed display claim

Problem: Does a friendly name prove the same workload remains selected?

  1. The display name changed and the stable identity evidence is missing.
  2. Verify the stable identifier and affected mappings and bindings before changing trust.
text Synthetic federation trust record
old external name=build-prod
new external name=build-main
stable identifier=not inspected

This fixture issues no token and makes no cloud request.

Expected result: Verify the stable identifier and affected mappings and bindings before changing trust.

Why this result follows: A mutable name can change without establishing workload identity continuity.

14. Direct grant versus impersonation

Problem: Does a direct resource grant prove impersonation permission?

  1. The listed grant concerns direct access to a bucket, not acting as the service account.
  2. Review the service-account policy separately if impersonation is required.
text Synthetic federation trust record
federated principal direct bucket read=granted
service-account impersonation=not inspected

This fixture issues no token and makes no cloud request.

Expected result: Review the service-account policy separately if impersonation is required.

Why this result follows: Direct resource access and impersonation are distinct authorization paths.

15. Unchanged policy

Problem: Does an unchanged target IAM policy mean the same external workloads retain access?

  1. The binding is unchanged but the values mapped into its selector may differ.
  2. Compare the old and new matching identities before approving the mapping change.
text Synthetic federation trust record
target binding=attribute.team:release unchanged
provider mapping=changed
matching workloads=not reviewed

This fixture issues no token and makes no cloud request.

Expected result: Compare the old and new matching identities before approving the mapping change.

Why this result follows: A stable binding can select a different population after mapping changes.

16. Expired assertion

Problem: Does a matching claim set alone establish a successful exchange?

  1. The request occurs after the assertion’s stated expiry.
  2. Do not claim exchange success; inspect validity and the supported external flow.
text Synthetic federation trust record
issuer and mapped claims=match model
assertion expiry=10:00
request time=10:05

This fixture issues no token and makes no cloud request.

Expected result: Do not claim exchange success; inspect validity and the supported external flow.

Why this result follows: Claim mapping does not replace assertion validity checks.

17. Wrong provider

Problem: Does a successful test of provider A establish provider B behavior?

  1. The observed success belongs to A, while B has a changed untested condition.
  2. Review and test B’s current configuration independently.
text Synthetic federation trust record
provider-A intended test=success
provider-B condition=changed
provider-B test=not run

This fixture issues no token and makes no cloud request.

Expected result: Review and test B’s current configuration independently.

Why this result follows: Provider-specific evidence cannot be transferred to a different configuration.

18. Unknown binding

Problem: Does a mapped principal name prove its requested role?

  1. The principal is identified, but no applicable target binding is recorded.
  2. Inspect the actual resource policy and requested permission.
text Synthetic federation trust record
mapped principal=workload-A
requested operation=read object
resource IAM=not inspected

This fixture issues no token and makes no cloud request.

Expected result: Inspect the actual resource policy and requested permission.

Why this result follows: A principal identifier does not itself grant a resource role.

19. External source reassignment

Problem: What risk exists if a trusted external identifier can be reassigned?

  1. The binding relies on an identifier whose lifecycle and reassignment controls are unknown.
  2. Review external identity ownership and lifecycle before relying on the privileged selector.
text Synthetic federation trust record
binding selector=external ID 123
external ID reassignment policy=unknown
privileged access=granted

This fixture issues no token and makes no cloud request.

Expected result: Review external identity ownership and lifecycle before relying on the privileged selector.

Why this result follows: A stable-looking identifier is only safe under its actual control and lifecycle contract.

20. Old negative test

Problem: Does last month’s negative test prove today’s mapping excludes the neighbor?

  1. The trust condition changed after the recorded negative test.
  2. Review the new mapping and repeat the authorized neighboring-identity test.
text Synthetic federation trust record
neighbor test=denied last month
attribute condition=changed this week
current test=not run

This fixture issues no token and makes no cloud request.

Expected result: Review the new mapping and repeat the authorized neighboring-identity test.

Why this result follows: Prior evidence applies to the tested condition and time.

Common errors and fixes

A mutable claim is treated as a stable identity

Why it happens
An actor might change the attribute used by a binding.
How to fix it
Select a suitably controlled immutable attribute.
Prevent it next time
Review issuer controls and mapping changes.

Token exchange is treated as resource permission

Why it happens
Admission and IAM authorization are separate.
How to fix it
Inspect the mapped principal and exact resource binding.
Prevent it next time
Test each boundary independently.

A failed request is fixed with a broad grant

Why it happens
The mapping, audience or target may be wrong.
How to fix it
Identify the failing stage before proposing a narrow correction.
Prevent it next time
Keep positive and negative federation tests.

20 practice exercises

1. A token exchange succeeds but the resource request is denied. What remains to check?

Show hint

Follow the mapped principal from exchange to the exact target operation.

Show worked solution

Compare the mapped principal, target resource, operation and applicable IAM binding; exchange success alone is not authorization.

A successful exchange establishes neither the resource binding nor the requested permission. Compare the mapped principal, target bucket or service, operation and applicable IAM conditions. If a service account is impersonated, inspect that permission and the account’s target access separately. Preserve sanitized results before proposing a narrow authorized correction.

Check your solution

  • Identify the mapped principal and exact resource operation.
  • Review applicable IAM independently of exchange success.

2. A user can change the claim used to select a privileged binding. What is the risk?

Show hint

Ask who can change or reassign the claim used by the privileged selector.

Show worked solution

The claim may be spoofed or change identity unexpectedly. Choose a controlled stable attribute and review affected bindings.

If an untrusted user can change the selected claim, an unintended workload may match a privileged principal set or a legitimate identity may change unexpectedly. Choose an appropriately controlled stable attribute where supported, inspect its lifecycle and review every affected mapping and binding. Test an intended and a neighboring identity under an approved plan.

Check your solution

  • Identify the mutable claim and its controlling authority.
  • Review affected bindings and a neighboring negative case.

3. An external token exchange succeeds, but a bucket read is denied. What should the reviewer inspect?

Show hint

Exchange and resource authorization are separate.

Show worked solution

Record the mapped principal, exact bucket and object, requested permission and applicable IAM binding and conditions. If impersonation is used, review that step separately; broadening provider trust does not diagnose a target-resource denial.

Check your solution

  • Identify the mapped principal and target.
  • Review resource IAM independently of exchange.

4. A user can edit a claim mapped to a privileged principal set. What risk and response follow?

Show hint

The selector must be controlled by an appropriate authority.

Show worked solution

The user may change the claim to match a privileged binding or alter the mapped identity. Review claim ownership and lifecycle, choose a controlled stable attribute where supported, and assess every affected binding before changing trust.

Check your solution

  • Identify the editable selector.
  • Review affected privileged bindings.

5. A workload receives a grant on bucket A but requests bucket B. Does the A grant establish B access?

Show hint

Compare the resource scope.

Show worked solution

No. Inspect bucket B’s applicable policy and the requested operation. The recorded grant is scoped to A and does not automatically establish permission on another bucket.

Check your solution

  • Identify A versus B.
  • Review B’s applicable IAM.

6. A provider accepts an external assertion, but service-account impersonation permission is uninspected. Is impersonation proven?

Show hint

Provider acceptance is one boundary.

Show worked solution

No. Review the mapped principal and the service account’s applicable policy and required impersonation permission. An accepted assertion does not itself establish permission to act as a service account.

Check your solution

  • Identify the uninspected account policy.
  • Separate provider trust from impersonation.

7. Impersonation succeeds, but the service account’s object-read permission is unknown. Is the object read established?

Show hint

Acting as the account does not define its target access.

Show worked solution

No. Inspect the account’s applicable resource policy, conditions and requested permission, then test the intended read under authorization. A successful credential path is not a successful resource operation.

Check your solution

  • Identify the unknown object permission.
  • Test target authorization separately.

8. A provider trusts a shared issuer but has not inspected the repository or workload claim. Is the intended repository identified?

Show hint

One issuer can represent multiple workloads.

Show worked solution

No. Review the provider’s attribute mapping and condition and the external identity provider’s controlled identifiers. A recognized issuer alone does not establish which repository or workload supplied the assertion.

Check your solution

  • Identify the uninspected workload attribute.
  • Review the provider condition and mapping.

9. A mapping changes attribute.team from claim A to claim B while an IAM binding stays unchanged. What review is needed?

Show hint

A stable binding can select a new population.

Show worked solution

Compare the identities and claim values that match before and after the change, including ownership of claim B. Review all affected bindings and plan an authorized neighboring-identity test before approving the mapping.

Check your solution

  • Identify the changed source claim.
  • Compare matching principals before and after.

10. Workload A exchanges successfully, but a negative test for neighboring workload B was not run. Is B excluded?

Show hint

A positive test does not prove a negative case.

Show worked solution

No. Review the provider condition and relevant bindings, then test B’s intended rejection or lack of access in an authorized isolated environment. Record the exact configuration and outcome.

Check your solution

  • Identify B as untested.
  • Require a separate negative test.

11. A provider condition requires repository ID 123, while the observed assertion has 456 and the issuer is accepted. Does the modeled condition match?

Show hint

Compare the workload attribute independently of the issuer.

Show worked solution

No. The repository identifiers differ, so the stated condition does not match this assertion. Verify the intended workload and controlled claim before proposing a trust change; issuer acceptance alone is insufficient.

Check your solution

  • Identify 123 versus 456.
  • Separate issuer acceptance from the condition.

12. Two workloads map to team=build, and a privileged binding selects that value. Can the selector distinguish them?

Show hint

Compare the mapped values.

Show worked solution

No. Both match the same selector in the fixture. Review whether both should receive access and use a more discriminating, controlled attribute if needed, then test the intended and neighboring identities.

Check your solution

  • Identify the shared mapped value.
  • Review both matching workloads.

13. An external workload’s friendly name changed, but its stable identifier was not inspected. Does the new name prove identity continuity?

Show hint

Names and stable identity evidence differ.

Show worked solution

No. Verify the external identifier and its ownership and lifecycle, then review affected mapping and IAM bindings. A mutable display name alone does not establish that the same workload remains selected.

Check your solution

  • Identify the missing stable identifier.
  • Review mapping and binding impact.

14. A federated principal has direct bucket read, but service-account impersonation was not inspected. Does the direct grant prove impersonation?

Show hint

These are different authorization paths.

Show worked solution

No. Review the service account’s policy and required impersonation permission separately if that path is needed. A direct grant on a bucket does not automatically permit acting as a service account.

Check your solution

  • Identify direct bucket access.
  • Keep impersonation unverified.

15. A target IAM binding is unchanged, but its provider mapping changed. Must the same external workloads still match?

Show hint

The mapping supplies values to the selector.

Show worked solution

Not necessarily. Compare old and new claim sources and mapped values, identify all workloads selected by the binding, and test the intended and neighboring cases before approving the change.

Check your solution

  • Identify the mapping change.
  • Compare the matching population.

16. Claims match a synthetic mapping, but the assertion expired at 10:00 and the request is 10:05. Is exchange success established?

Show hint

Claim matching does not replace validity.

Show worked solution

No. The request is after the assertion’s stated expiry. Review the supported credential flow and validity context without retaining the assertion; do not claim a successful exchange from matching text alone.

Check your solution

  • Identify the five-minute expiry gap.
  • Separate mapping from assertion validity.

17. Provider A passed a test, but provider B’s condition changed and B was not tested. Does A’s result validate B?

Show hint

Evidence is configuration-specific.

Show worked solution

No. Inspect B’s current condition and mapping and run authorized positive and negative tests for B. A success on another provider is useful for that provider only.

Check your solution

  • Identify provider B as untested.
  • Require B-specific current evidence.

18. The mapped principal is known, but target IAM was not inspected. Does the principal name grant object read?

Show hint

Identity and permission are separate.

Show worked solution

No. Inspect the exact resource, requested permission, applicable IAM binding and conditions. A mapped principal identifier describes who is requesting access; it does not grant a role by itself.

Check your solution

  • Identify target IAM as uninspected.
  • Review the requested permission.

19. A privileged binding selects external ID 123, but the issuer’s reassignment policy is unknown. What must be reviewed?

Show hint

Identifier lifecycle affects trust.

Show worked solution

Review who controls, changes or can reassign that identifier and how the provider maps it. A stable-looking value is not sufficient without its actual lifecycle and ownership guarantees; reassess affected bindings.

Check your solution

  • Identify unknown reassignment controls.
  • Review ownership and affected bindings.

20. A neighboring workload was denied last month, but the provider condition changed this week. Is exclusion still proven?

Show hint

Bind evidence to the tested condition and time.

Show worked solution

No. Review the current mapping and condition, then repeat an authorized negative test for the neighboring workload and the relevant resource path. Preserve the old result as historical evidence only.

Check your solution

  • Identify the condition change.
  • Require current negative evidence.

Key takeaways

  • Federation exchanges an external identity for a Google token.
  • Mapping and admission are separate from resource authorization.
  • Test both intended and excluded identities.
  • Successful exchange does not prove target access.
  • A mutable claim can weaken a privileged principal selector.
  • Federation evidence must include scope, time and sanitized outcomes.

Official references