Skip to content

feat(warehouse): bigquery workload identity federation authentication - #7361

Merged
achettyiitr merged 14 commits into
masterfrom
worktree-bq-wif-bigquery
Sep 21, 2026
Merged

achettyiitr merged 14 commits into
masterfrom
worktree-bq-wif-bigquery

Conversation

@krishna2020

@krishna2020 krishna2020 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds Workload Identity Federation as an authentication method for the BigQuery warehouse destination, so no static service account key has to be stored.

With authMethod: workloadIdentityFederation, rudder-server uses googleutil.AWSFederatedTokenSource (rudderlabs/rudder-go-kit#1214):

  1. Gets AWS credentials with the workspace ID as the role session name, from RUDDER_GCP_FEDERATION_AWS_ROLE_ARN when set, otherwise from the pod's IRSA role (AWS_ROLE_ARN / AWS_WEB_IDENTITY_TOKEN_FILE). The region comes from AWS_REGION (default us-east-1).
  2. Exchanges them at Google STS through the customer's pool (workloadIdentityProjectNumber, workloadIdentityPoolId, workloadIdentityProviderId).
  3. Impersonates workloadIdentityTargetServiceAccount if set. Otherwise it uses the federated token directly (roles granted to the pool principal).

Customers can restrict the grant to their workspace with the attribute mapping attribute.workspace=assertion.arn.extract('assumed-role/<role>/{workspace}').

Without authMethod or with serviceAccountKey, behaviour is unchanged: credentials must be a service account key, or empty under GKE Workload Identity.

Changes

  • warehouse/integrations/bigquery: authOptions() picks federation or the service account key. connect() builds the options once and stores them, and jobStatistics() reuses them, so federation does not exchange credentials again for every table load. As a side effect, jobStatistics() now honours googleutil.ShouldSkipCredentialsInit like connect() (under GKE workload identity with empty credentials it uses Application Default Credentials instead of failing).
  • warehouse/internal/model: settings for authMethod and the four workload identity keys, in their own group.
  • warehouse/identity: identity resolution uploads pass the workspace ID, so their GCS uploads authenticate with federation too.
  • utils/misc: GetRudderGCPFederationAWSRoleAndRegion(conf) (BigQuery passes its injected config). GetObjectStorageConfig injects workspaceID, workloadIdentityAWSRoleARN and workloadIdentityAWSRegion for GCS, so staging uploads through the go-kit GCS manager authenticate the same way.
  • go.mod: rudder-go-kit bumped to v0.80.0 (includes feat: authenticate to GCP via AWS workload identity federation rudder-go-kit#1214).

Temporary: Redshift integration test skipped

warehouse/integrations/redshift TestIntegration is skipped because the shared Redshift test user is locked (pq: Account locked due to multiple failed login attempts (28000)), which fails the Redshift job on every PR, not just this one. Unrelated to this change; re-enable once the user is unlocked.

Testing

  • TestWorkloadIdentityFederation: with and without a target service account, connect() succeeds without reading credentials (an authorized_user value that would be rejected) and stores the auth options reused by job statistics.
  • TestUnsupportedCredentialType (new): authorized_user is still rejected for the service account key method. TestUnsupportedCredentials is unchanged.
  • utils/misc: federation fields are injected for GCS object storage config.
  • TestIntegration/Workload identity federation (real AWS and GCP, BIGQUERY_WIF_INTEGRATION_TEST_CREDENTIALS, checked with the other BigQuery secret at the start of TestIntegration): for both service account impersonation and federated identities, stages a load file through the GCS manager, creates the dataset and table, loads 14 rows and reads them back using only federation; a different workspace is denied. CI assumes the federation test role with the Ginkgo AWS credentials (tests.yaml now sets them for bigquery too). Passed locally.
  • Verified end to end on hostedmt-dev (pr-7361, rudderlabs/rudder-devops#8528) with both options.

Related: rudderlabs/rudder-integrations-config#2740 (dashboard config).

🤖 Generated with Claude Code

Let the BigQuery destination's `credentials` field hold a Workload
Identity Federation (WIF) credential configuration
(external_account / external_account_authorized_user), not just a
static service account key. Such a configuration can carry a
service_account_impersonation_url, so a customer can authenticate
through an external identity provider (AWS, Azure, OIDC/SAML) and
impersonate a GCP service account for short-lived tokens - no static
private key stored in the destination config.

- connect() and jobStatistics() now share a new authOptions() helper,
  which validates the credentials via
  googleutil.CompatibleFederatedCredentialsJSON (accepts
  service_account, external_account, external_account_authorized_user)
  and passes the actual credential type through to
  option.WithAuthCredentialsJSON, instead of hardcoding
  option.ServiceAccount.

- Fixes a pre-existing gap along the way: jobStatistics() used to
  always require a static service_account key and skip the
  ShouldSkipCredentialsInit check that connect() already applied, so
  it broke under GKE Workload Identity (empty credentials) even though
  connect() worked fine. It now goes through the same authOptions()
  path as connect().

Depends on rudderlabs/rudder-go-kit#1214 (adds
googleutil.CompatibleFederatedCredentialsJSON / CredentialType) -
this PR is opened as a draft and won't build against the currently
pinned go-kit v0.78.2 until that lands and go.mod is bumped.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Scanned-by: gitleaks 8.29.0
…ration

Add authMethod "workloadIdentityFederation" to the BigQuery destination. With
it, no credentials are stored: rudder-server assumes RudderStack's AWS
federation role (RUDDER_GCP_FEDERATION_AWS_ROLE_ARN, AWS_REGION) with the
workspace ID as the role session name, exchanges those credentials through the
customer's workload identity pool, and impersonates the customer's service
account. The customer binds the service account to their workspace ID, so the
grant cannot be used by any other workspace.

- bigquery: authOptions branches on authMethod; the default path accepts only a
  service account key again, reverting acceptance of pasted external_account
  configurations whose credential_source a destination could control.
- misc: GetObjectStorageConfig passes the workspace ID and federation role to
  GCS configs, so staging uploads authenticate the same way.
- model: authMethod, targetServiceAccount and workload identity pool settings.
- bump rudder-go-kit for googleutil.AWSFederatedTokenSource; this raises the go
  directive to 1.27.1.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
…query

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr achettyiitr changed the title bigquery: accept Workload Identity Federation credentials (blocked on go-kit#1214) feat: accept Workload Identity Federation credentials (blocked on go-kit#1214) Sep 16, 2026
@achettyiitr achettyiitr changed the title feat: accept Workload Identity Federation credentials (blocked on go-kit#1214) feat: accept Workload Identity Federation credentials Sep 16, 2026
…tion

When RUDDER_GCP_FEDERATION_AWS_ROLE_ARN is unset, rudder-go-kit now assumes
the pod's IRSA role via web identity with the workspace ID as the session
name, so no dedicated IAM role is required. The federation region follows
the existing AWS_S3_REGION_HINT convention via misc.GetRegionHint().

Bump rudder-go-kit for the fallback.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
…tyTargetServiceAccount

Match the workloadIdentity prefix of the other workload identity federation
destination settings, and bump rudder-go-kit for the GCS manager rename.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.86%. Comparing base (9f9bcde) to head (25e438b).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
warehouse/integrations/bigquery/bigquery.go 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7361      +/-   ##
==========================================
- Coverage   84.41%   83.86%   -0.55%     
==========================================
  Files         620      620              
  Lines       62640    62683      +43     
==========================================
- Hits        52876    52569     -307     
- Misses       9761    10111     +350     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ervice account

Bump rudder-go-kit so workload identity federation impersonates the
target service account only when set and otherwise uses the federated
token directly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr achettyiitr changed the title feat: accept Workload Identity Federation credentials feat(warehouse): bigquery workload identity federation authentication Sep 17, 2026
Bump rudder-go-kit and inject workspaceID, workloadIdentityAWSRoleARN and
workloadIdentityAWSRegion for GCS object storage.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
…ntity uploads

Build the BigQuery auth options once in connect so job statistics do not
exchange federated credentials again for every table load, pass the workspace
ID to identity resolution uploads, read the federation role through injected
config, and bump rudder-go-kit for the read/write GCS federation scope.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
…n test

Load data through service account impersonation and through federated
identities, authenticating to Cloud Storage and BigQuery only via AWS
workload identity federation, and check that another workspace is denied.
CI assumes the federation test role with the Ginkgo AWS credentials.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr marked this pull request as ready for review September 17, 2026 08:49
@achettyiitr
achettyiitr self-requested a review September 17, 2026 08:56
…n TestIntegration

make test-warehouse runs -run 'TestIntegration', which never selected the
separate TestWorkloadIdentityFederationIntegration. Move it into
bigquery_test.go as a subtest and check both credential secrets up front.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
Comment thread utils/misc/misc.go Resolved
Use the standard AWS_REGION variable instead of the S3-specific
AWS_S3_REGION_HINT for workload identity federation, defaulting to us-east-1.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
…s locked

The shared Redshift test user is locked (pq 28000: account locked due to
multiple failed login attempts), failing every run across PRs. Re-enable once
it is unlocked.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr merged commit d16ab5f into master Sep 21, 2026
71 checks passed
@achettyiitr
achettyiitr deleted the worktree-bq-wif-bigquery branch September 21, 2026 11:01
This was referenced Sep 21, 2026
achettyiitr pushed a commit that referenced this pull request Sep 21, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.88.0-rc.1](v1.87.0...v1.88.0-rc.1)
(2026-09-21)


### Features

* **warehouse:** bigquery workload identity federation authentication
([#7361](#7361))
([d16ab5f](d16ab5f))


### Bug Fixes

* bound clickHouse v2 s3 copy memory
([#7407](#7407))
([a17a78f](a17a78f))


### Miscellaneous

* cleanup python mirroring
([#7395](#7395))
([9f9bcde](9f9bcde))
* default failed-keys error capture on
([#7404](#7404))
([db84987](db84987))
* sync release v1.87.0 to main branch
([#7394](#7394))
([80353d1](80353d1))
* tag namespace config http client stats with version and mode
([#7401](#7401))
([d152ae5](d152ae5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
mihir20 pushed a commit that referenced this pull request Sep 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.88.0](v1.87.0...v1.88.0)
(2026-09-21)


### Features

* **warehouse:** bigquery workload identity federation authentication
([#7361](#7361))
([d16ab5f](d16ab5f))


### Bug Fixes

* bound clickHouse v2 s3 copy memory
([#7407](#7407))
([a17a78f](a17a78f))


### Miscellaneous

* cleanup python mirroring
([#7395](#7395))
([9f9bcde](9f9bcde))
* default failed-keys error capture on
([#7404](#7404))
([db84987](db84987))
* sync release v1.87.0 to main branch
([#7394](#7394))
([80353d1](80353d1))
* tag namespace config http client stats with version and mode
([#7401](#7401))
([d152ae5](d152ae5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

2 participants