Skip to content

fix(warehouse): use pod identity for rudder-storage flow; keep S3-copy user fallback for user S3 destinations - #7167

Merged
shekhar-rudder merged 7 commits into
masterfrom
fix/remove-s3-copy-user
Jul 16, 2026
Merged

shekhar-rudder merged 7 commits into
masterfrom
fix/remove-s3-copy-user

Conversation

@shekhar-rudder

@shekhar-rudder shekhar-rudder commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

What

Stops the useRudderStorage flow from authenticating with a broadly-scoped static credential, while preserving the shared S3-copy user as the fallback for customer-configured S3 destinations that supply no auth of their own.

  • Rudder-storage flow → AWS SDK default credential chain. misc.GetRudderObjectStorageConfig and the useRudderStorage branch of warehouseutils.CreateAWSSessionConfig no longer read RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID/KEY. Access to the intermediate rudder-warehouse-storage* buckets now resolves through the AWS SDK default credential chain — i.e. the pod identity role (IRSA) — instead of the static copy-user credential.
  • Non-rudder-storage flow → copy-user fallback kept. misc.GetObjectStorageConfig and the non-rudder-storage branch of CreateAWSSessionConfig still fall back to the shared copy-user credentials when a user-configured S3 destination provides neither an IAM role ARN nor access keys. Customers grant this user write access to their bucket precisely so RudderStack can deliver data when they don't supply their own credentials, so this path must be retained.
  • Fix the warehouse COPY temp-credential path (required by the change above). GetTemporaryS3Cred now retrieves already-temporary credentials directly from the default chain when there are no static keys (sessionConfig.AccessKeyID == ""), in addition to the role-based case. This is needed because the rudder-storage flow now returns a credential-less session config: GetSessionToken rejects the temporary credentials the default chain hands back, so the pod-identity path would otherwise fail. Customer-supplied long-term static keys still go through STS GetSessionToken as before.

Why

Only the useRudderStorage flow should stop using the shared copy user — that flow targets RudderStack-owned buckets and should authenticate via pod identity (IRSA). The non-rudder-storage flow is different: our customers explicitly grant the copy user write access to their S3 bucket for the case where they configure no IAM role or access keys, so removing the fallback there would break delivery to those destinations.

Note: an earlier revision of this PR removed the copy user from both flows (making missing auth a hard ErrS3MissingCredentials failure). That was incorrect for the non-rudder-storage flow and has been reverted — GetObjectStorageConfig keeps its original map[string]any signature and the sentinel error was dropped.

Infra pre-conditions

  • The pod identity (IRSA) role on the warehouse pods already has read/write on rudder-warehouse-storage*, so the useRudderStorage upload/COPY flow authenticates via the AWS SDK default credential chain with no further infra change.
  • RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID/KEY must remain configured, since the non-rudder-storage fallback still consumes them.

Tests

  • Unit tests updated and passing: TestGetObjectStorageConfig, TestGetRudderObjectStorageConfig (utils/misc), TestCreateAWSSessionConfig (warehouse/utils). They assert that the rudder-storage flow injects no static creds, and that the non-rudder-storage flow falls back to the copy-user credentials when no role/keys are present.
  • Restored the useRudderStorage warehouse integration cases for redshift and snowflake. Instead of the app-specific copy-user envs, they now supply generic AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY envs so the AWS SDK default credential chain resolves them automatically — exercising the same credential path the useRudderStorage flow uses in production (pod identity / IRSA).
  • Restored the deltalake useRudderStorage case too. Deltalake's COPY runs on Databricks via the S3A TemporaryAWSCredentialsProvider, which requires a non-empty session token. In production the useRudderStorage path uses IRSA/pod-identity, whose default-chain credentials are already temporary and carry a session token. The test mirrors this: it mints a session token from the static test keys via STS GetSessionToken and exports it through the standard AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN envs — no app-specific credential env reintroduced.
  • go build ./... and go vet clean across affected packages.

🤖 Generated with Claude Code

@shekhar-rudder shekhar-rudder changed the title fix(security): remove shared S3-copy user; require explicit auth for S3 destinations fix(warehouse): remove shared S3-copy user; require explicit auth for S3 destinations Jul 9, 2026
@shekhar-rudder
shekhar-rudder force-pushed the fix/remove-s3-copy-user branch from f5213ce to cd5d4ad Compare July 9, 2026 12:50
@shekhar-rudder

Copy link
Copy Markdown
Member Author

E2E Test Report

Verified against a local rudder-mini stack running an image built from this branch (fix/remove-s3-copy-user @ ecd3220fe; /version → Commit: ecd3220fe), plus real AWS S3 + Snowflake for the credential-chain paths. Throughout, RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID/KEY were set to poison values to prove they're never read.

Results

# Scenario Path exercised Env Result
1 S3 batch dest with keys GetObjectStorageConfig S3+keys — credential gate local ✅ Gate passes: flow reaches real S3 PutObject, not the sentinel (distinguishes cleanly from #3)
2 Batch non-S3 provider (MINIO) provider ≠ S3, unchanged local ✅ 25/25 batch-router jobs succeeded; object written
3 S3 batch dest no keys/role ⚠️ ErrS3MissingCredentials local ✅ 25/25 jobs fail with "S3 access requires an IAM role ARN or access keys"; no object written; no fallback; copy-user poison never consulted
4 Batch useRudderStorage staging upload rudder config, no static keys → AWS SDK default chain real AWS S3 ✅ Staging file uploaded to s3://…/rudder-warehouse-staging-logs/… via default chain (pod-identity emulated by env creds); no static creds in config
5 Snowflake useRudderStorage COPY CreateAWSSessionConfig no-static-creds + GetTemporaryS3Cred AccessKeyID=="" branch (STS GetSessionToken skipped) real AWS S3 + Snowflake ✅ copying data into main table; warehouse upload → exported_data; direct Snowflake query: 10 + 10 rows loaded. COPY succeeded using temporary creds that STS GetSessionToken would have rejected → proves the STS-skip branch

⚠️ #3 is the new hard-fail behavior this PR introduces (previously fell back to the shared copy-user).

Pod-identity emulation (for #4/#5)

No IRSA cluster was available, so the pod-identity path was exercised by feeding AWS creds to rudder-server through the SDK default credential provider chain via env vars. The executed code path is identical to IRSA: GetRudderObjectStorageConfig injects no credentials → awsutil.CreateAWSConfig passes a nil provider → LoadDefaultConfig resolves via the default chain (env → shared config → EKS Pod Identity / IRSA in prod). #5's COPY succeeding with temporary session-token creds confirms GetTemporaryS3Cred retrieves them directly and skips GetSessionToken.

Not run

useRudderStorage=false physical S3 upload (#1 full) and the Snowflake COPY with user-supplied static keys / role require long-term IAM keys (AKIA…) / an assumable role, which weren't available (only temporary SSO creds). Note a user S3 destination can only be tested with long-term keys anyway: config-backend serves the data plane only the destination-definition's declared config fields, so a sessionToken (needed by temporary creds) is stripped from the workspace config. These paths remain covered by the updated unit tests (TestGetObjectStorageConfig, TestGetRudderObjectStorageConfig, TestCreateAWSSessionConfig).

Verdict

The security-critical behaviors verified end-to-end: (a) missing S3 credentials now hard-fail with no fallthrough to any RudderStack-owned credential (#3), and (b) the useRudderStorage upload and warehouse COPY both authenticate via the AWS SDK default chain / pod identity with no static credentials (#4, #5). ✅

🤖 E2E run via Claude Code

@shekhar-rudder
shekhar-rudder force-pushed the fix/remove-s3-copy-user branch from cd5d4ad to ce566fd Compare July 9, 2026 13:04
… S3 destinations

Hardens object-storage credential resolution so RudderStack-owned
credentials can never be used to authenticate writes to a user-configured
S3 destination.

- Remove the shared "S3-copy" IAM user from the code path. No non-test code
  reads RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID/KEY anymore. Access to the
  intermediate rudder-warehouse-storage* buckets (the useRudderStorage flow)
  now resolves through the AWS SDK default credential chain (pod identity /
  IRSA) instead of a broadly-scoped static credential.
- Require explicit auth for user S3 destinations. misc.GetObjectStorageConfig
  now returns (map, error) and warehouseutils.CreateAWSSessionConfig errors
  with the new sentinel misc.ErrS3MissingCredentials when an S3 destination
  supplies neither an IAM role ARN nor access keys. Previously such a
  destination silently fell back to the shared copy-user credentials; it now
  fails (retry-then-abort) and can never fall through to the pod identity role.
- Fix the warehouse COPY temp-credential path. GetTemporaryS3Cred now
  retrieves already-temporary credentials from the default chain directly
  (role-based auth and pod identity), and only calls STS GetSessionToken for
  customer-supplied long-term static keys.

Tests updated accordingly: no-auth S3 asserts the sentinel error, copy-user
env is never consulted, untestable useRudderStorage integration cases are
dropped, and upload/cleanup tests supply explicit S3 credentials.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder force-pushed the fix/remove-s3-copy-user branch from ce566fd to d095e0d Compare July 9, 2026 13:50
@codecov

codecov Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.12%. Comparing base (581410c) to head (0234ddf).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
warehouse/utils/utils.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7167      +/-   ##
==========================================
+ Coverage   80.01%   80.12%   +0.11%     
==========================================
  Files         595      595              
  Lines       66133    66155      +22     
==========================================
+ Hits        52915    53008      +93     
+ Misses      10071    10011      -60     
+ Partials     3147     3136      -11     

☔ 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.

…ic AWS env

Re-add the useRudderStorage upload/merge integration cases dropped in the
previous commit (redshift, snowflake, deltalake). Instead of the retired
app-specific copy-user envs (RUDDER_AWS_S3_COPY_USER_ACCESS_KEY_ID/KEY),
these now supply generic AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY envs so the
AWS SDK default credential chain resolves them automatically — the same path
the useRudderStorage flow uses in production (pod identity / IRSA).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
shekhar-rudder and others added 3 commits July 13, 2026 13:13
Deltalake's COPY runs on Databricks via the S3A TemporaryAWSCredentialsProvider,
which requires a non-empty session token. In production the useRudderStorage
path authenticates via IRSA/pod-identity, whose credentials are already
temporary and carry a session token, so the COPY works. A static-key
integration test cannot produce a session token, so the case cannot be
faithfully exercised in CI. This is a test-environment limitation, not a
production bug — redshift and snowflake tolerate an empty token and remain
restored.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…TS session token

Deltalake's COPY runs on Databricks via the S3A TemporaryAWSCredentialsProvider,
which requires a non-empty session token. Production resolves temporary,
session-token credentials from the AWS SDK default chain (IRSA/pod-identity).

Mirror that in the test: mint a session token from the static test keys via STS
GetSessionToken and export it through the standard AWS_ACCESS_KEY_ID /
AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN envs, so the SDK default chain resolves
temporary creds with a token — no production code change and no app-specific
credential env. redshift/snowflake are unchanged (their COPY tolerates an empty
token and already pass).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… in deltalake temp-cred minting

Matches production, which resolves the region hint via misc.GetRegionHint()
(defaults to us-east-1, overridable via AWS_S3_REGION_HINT) rather than
hardcoding it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread utils/misc/misc.go Resolved
The copy-user credentials (RUDDER_AWS_S3_COPY_USER_*) must only be dropped
from the rudder-storage flow. Customer-configured (non-rudder-storage) S3
locations that provide neither an IAM role ARN nor access keys still rely on
the shared RudderStack copy user, which customers grant write access to their
bucket.

Restore the copy-user fallback in misc.GetObjectStorageConfig and
warehouseutils.CreateAWSSessionConfig (reverting GetObjectStorageConfig to its
non-error signature and dropping ErrS3MissingCredentials), while keeping the
rudder-storage flow on the AWS SDK default credential chain (pod identity /
IRSA). Added comments explaining the fallback where the env is consumed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@shekhar-rudder shekhar-rudder changed the title fix(warehouse): remove shared S3-copy user; require explicit auth for S3 destinations fix(warehouse): use pod identity for rudder-storage flow; keep S3-copy user fallback for user S3 destinations Jul 15, 2026
Comment thread warehouse/utils/utils.go Resolved
@shekhar-rudder
shekhar-rudder force-pushed the fix/remove-s3-copy-user branch from db977eb to 65f3ef5 Compare July 15, 2026 12:48
…creds

Replace the sessionConfig.AccessKeyID == "" proxy in GetTemporaryS3Cred
with an explicit misc.IsConfiguredToUseRudderObjectStorage check, so the
retrieve-directly path is taken only for role-based auth and the
rudder-storage (IRSA/pod-identity) flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder force-pushed the fix/remove-s3-copy-user branch from 65f3ef5 to 0234ddf Compare July 16, 2026 05:29
@shekhar-rudder
shekhar-rudder merged commit 3f9aa32 into master Jul 16, 2026
74 of 75 checks passed
@shekhar-rudder
shekhar-rudder deleted the fix/remove-s3-copy-user branch July 16, 2026 11:20
This was referenced Jul 20, 2026
mihir20 pushed a commit that referenced this pull request Jul 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.81.0-rc.1](v1.80.0...v1.81.0-rc.1)
(2026-07-20)


### Features

* run python transformation tests on ephemeral per-request pyt
deployments
([#7177](#7177))
([1008ae7](1008ae7))
* support partition migration job fanout per jobsdb
([#7141](#7141))
([be42e48](be42e48))


### Bug Fixes

* abort snowpipe events on channel bad request
([#7118](#7118))
([6c08584](6c08584))
* avoid redundant transformer statTags unmarshalling
([#7182](#7182))
([c3c283c](c3c283c))
* classify reverse-ETL sources from config for MAR metering
([#7159](#7159))
([fa7870f](fa7870f))
* detect server-side snowpipe channel failures via per-channel status at
stuck threshold
([#7166](#7166))
([581410c](581410c))
* kafkamanager compilation error
([#7189](#7189))
([1fb7f6e](1fb7f6e))
* **kafka:** support insecure TLS skip verify config
([#7022](#7022))
([d01574f](d01574f))
* preserve order when overflowing snowpipe insert batches
([#7178](#7178))
([9c01fa0](9c01fa0))
* quote postgres warehouse ddl identifiers
([#7127](#7127))
([5aeb481](5aeb481))
* **router:** emit invalid payload metric
([#7168](#7168))
([6e2009a](6e2009a))
* update null to #N/A for salesforce bulk upload
([#7151](#7151))
([1dffd93](1dffd93))
* **warehouse:** use pod identity for rudder-storage flow; keep S3-copy
user fallback for user S3 destinations
([#7167](#7167))
([3f9aa32](3f9aa32))


### Miscellaneous

* add contract tests for test endpoints in pytransformer
([#7147](#7147))
([3b210ec](3b210ec))
* bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815
([#7162](#7162))
([7672f96](7672f96))
* **deps:** bump actions/checkout from 6.0.3 to 7.0.0
([#7132](#7132))
([d453c93](d453c93))
* **deps:** bump actions/setup-go from 6.4.0 to 6.5.0
([#7150](#7150))
([75d9648](75d9648))
* **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6
([#7109](#7109))
([7b2a859](7b2a859))
* **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to
6.2.2 ([#7152](#7152))
([c984268](c984268))
* **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0
([#7170](#7170))
([4565d25](4565d25))
* **deps:** bump the frequent group across 1 directory with 4 updates
([#6891](#6891))
([88a0ddf](88a0ddf))
* support compression in bqstream destinations
([#7142](#7142))
([0694f12](0694f12))

---
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 Jul 21, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.81.0](v1.80.0...v1.81.0)
(2026-07-20)


### Features

* run python transformation tests on ephemeral per-request pyt
deployments
([#7177](#7177))
([1008ae7](1008ae7))
* support partition migration job fanout per jobsdb
([#7141](#7141))
([be42e48](be42e48))


### Bug Fixes

* abort snowpipe events on channel bad request
([#7118](#7118))
([6c08584](6c08584))
* avoid redundant transformer statTags unmarshalling
([#7182](#7182))
([c3c283c](c3c283c))
* classify reverse-ETL sources from config for MAR metering
([#7159](#7159))
([fa7870f](fa7870f))
* detect server-side snowpipe channel failures via per-channel status at
stuck threshold
([#7166](#7166))
([581410c](581410c))
* kafkamanager compilation error
([#7189](#7189))
([1fb7f6e](1fb7f6e))
* **kafka:** support insecure TLS skip verify config
([#7022](#7022))
([d01574f](d01574f))
* preserve order when overflowing snowpipe insert batches
([#7178](#7178))
([9c01fa0](9c01fa0))
* quote postgres warehouse ddl identifiers
([#7127](#7127))
([5aeb481](5aeb481))
* **router:** emit invalid payload metric
([#7168](#7168))
([6e2009a](6e2009a))
* update null to #N/A for salesforce bulk upload
([#7151](#7151))
([1dffd93](1dffd93))
* **warehouse:** use pod identity for rudder-storage flow; keep S3-copy
user fallback for user S3 destinations
([#7167](#7167))
([3f9aa32](3f9aa32))


### Miscellaneous

* add contract tests for test endpoints in pytransformer
([#7147](#7147))
([3b210ec](3b210ec))
* bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815
([#7162](#7162))
([7672f96](7672f96))
* **deps:** bump actions/checkout from 6.0.3 to 7.0.0
([#7132](#7132))
([d453c93](d453c93))
* **deps:** bump actions/setup-go from 6.4.0 to 6.5.0
([#7150](#7150))
([75d9648](75d9648))
* **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6
([#7109](#7109))
([7b2a859](7b2a859))
* **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to
6.2.2 ([#7152](#7152))
([c984268](c984268))
* **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0
([#7170](#7170))
([4565d25](4565d25))
* **deps:** bump the frequent group across 1 directory with 4 updates
([#6891](#6891))
([88a0ddf](88a0ddf))
* support compression in bqstream destinations
([#7142](#7142))
([0694f12](0694f12))

---
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.

3 participants