Skip to content

feat(google): keyless auth via Workload Identity Federation - #347

Open
sjawhar wants to merge 1 commit into
awslabs:masterfrom
trajectory-labs-pbc:wif-keyless
Open

feat(google): keyless auth via Workload Identity Federation#347
sjawhar wants to merge 1 commit into
awslabs:masterfrom
trajectory-labs-pbc:wif-keyless

Conversation

@sjawhar

@sjawhar sjawhar commented Jul 16, 2026

Copy link
Copy Markdown

What

Adds a keyless authentication path to internal/google.NewClient: when no service-account key is supplied, it uses Application Default Credentials to impersonate the target service account (google.golang.org/api/impersonate), carrying the Workspace admin in Subject so domain-wide delegation still works.

  • The existing downloaded-key path (google.JWTConfigFromJSON) is unchanged — fully backward compatible.
  • The keyless path activates only when serviceAccountKey is empty and GOOGLE_IMPERSONATE_SERVICE_ACCOUNT names the service account to impersonate.
  • Requested OAuth scopes and the DWD Subject are unchanged.

Why

ssosync currently requires a downloaded SA key, which is a blocker under iam.disableServiceAccountKeyCreation or when running outside GCP. This enables the modern keyless pattern: e.g. an AWS Lambda federated to GCP via Workload Identity Federation, impersonating the sync SA, with no long-lived credential.

Testing

go build / go vet / make ci (golangci-lint + go test ./internal/...) pass. Running in production: an AWS Lambda federated to GCP via WIF, impersonating the Workspace sync service account, syncing groups into IAM Identity Center on a schedule.

Closes #345.

NewClient now branches on whether a service-account key is supplied:
- key present  -> existing JWTConfigFromJSON + Subject (domain-wide delegation)
- key absent   -> ADC (e.g. an AWS Lambda role federated to GCP via Workload
                  Identity Federation) + impersonate.CredentialsTokenSource with
                  Subject, so DWD still applies. Target SA is named by the
                  GOOGLE_IMPERSONATE_SERVICE_ACCOUNT env var.

Lets ssosync run with zero long-lived credentials where org policy forbids
service-account key creation (constraints/iam.disableServiceAccountKeyCreation).
@amontalban

Copy link
Copy Markdown

Thank you @sjawhar I was looking for this exact feature to avoid storing SA keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyless Google auth via Workload Identity Federation (no downloaded service-account key)

2 participants