Skip to content

fix(warehouse): pass temporary credentials to the clickhouse v2 s3 copy engine - #7353

Merged
achettyiitr merged 3 commits into
release/1.86.xfrom
fix.ch-v2-s3-rudder-storage
Sep 9, 2026
Merged

achettyiitr merged 3 commits into
release/1.86.xfrom
fix.ch-v2-s3-rudder-storage

Conversation

@achettyiitr

@achettyiitr achettyiitr commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Description

ObjectStorageType reports S3 whenever useRudderStorage is set, so UseS3CopyEngineForLoading engaged and credentials() then read accessKeyID / accessKey off the destination config — which describes the customer's bucket, not Rudder's. They came back empty and were interpolated into the s3 table function as '', which the server rejects as an access error that says nothing about where the keys should have come from.

Rudder storage is not the only destination without keys

destination shape holds keys in config?
rudder storage (useRudderStorage) no — Rudder's bucket, reached via the SDK credential chain
role-based (iamRoleARN) no
shared copy user (neither keys nor role) no — keys live in the server's env, see misc.GetObjectStorageConfig
static keys yes

All three keyless shapes authenticate through the AWS SDK credential chain, which the s3 table function cannot use because it only takes literals.

The fix

Mint the literals instead of enumerating which shape the destination is. whutils.GetTemporaryS3Cred already covers every one of them, and redshift, snowflake and deltalake all build their copy credentials from it unconditionally for exactly this reason:

case warehouseutils.S3:
	accessKeyID, secretAccessKey, sessionToken, err = ch.TemporaryS3Cred(&ch.Warehouse.Destination)

ClickHouse can do the same because the s3 table function has taken a session token as its fourth positional argument since 24.1 (ClickHouse/ClickHouse#57850):

s3(url, access_key_id, secret_access_key, session_token, format, structure, compression_method)

So the copy engine stays available to every aws destination rather than falling back to downloading each load file — which is the larger win, since that engine is the fastest path we have.

Compatibility

  • The token is omitted from the statement when there is none, so minio and any static-key path send the six arguments they always sent. Nothing regresses on a server older than 24.1.
  • v1 keeps skipping the engine for rudder storage: it has no temporary-credential path and runs against ClickHouse 21, which predates the argument entirely.
  • The query-log mask (s3CredentialsRegex) widens to cover a third credential argument.

Behaviour change worth noting

A static-key S3 destination now also goes through STS, so it needs sts:GetSessionToken on the IAM user, and the statement carries a credential that expires after Warehouse.awsCredsExpiryInS (1h default) rather than the customer's long-term secret. That is the same trade redshift, snowflake and deltalake already make.

Tests

  • Unit: four destination shapes — rudder storage, role, no credentials at all, static keys — all asserted to reach the same mint call; minio asserted never to.
  • Integration: a new Load Table round trip case reaches the same minio bucket as an aws destination, minting from minio's own STS, so the session token the statement carries is one the bucket actually validates end to end.

Linear Ticket

https://linear.app/rudderstack/issue/INT-7100/crew-workspace-loading-is-taking-lot-of-time

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@achettyiitr
achettyiitr force-pushed the fix.ch-v2-s3-rudder-storage branch from e5bf1c0 to 22fa6d1 Compare September 8, 2026 08:47
…py engine

ObjectStorageType reports S3 whenever useRudderStorage is set, so
UseS3CopyEngineForLoading engaged and credentials() then read accessKeyID
and accessKey off the destination config — which describes the customer's
bucket, not Rudder's. They came back empty and were interpolated into the s3
table function as '', which the server rejects as an access error that says
nothing about where the keys should have come from.

Rudder storage is not the only destination that holds no keys. A role-based
one carries an iamRoleARN instead, and one with neither falls back to the
shared copy user whose credentials live in the server's env — see
GetObjectStorageConfig. All three authenticate through the AWS SDK credential
chain, which the s3 table function cannot use because it only takes literals.

So mint the literals instead of enumerating which shape the destination is.
whutils.GetTemporaryS3Cred already covers every one of them, including plain
static keys, and redshift, snowflake and deltalake all build their copy
credentials from it unconditionally for exactly this reason. ClickHouse can
too: the s3 table function has taken a session token as its fourth positional
argument since 24.1, so the copy engine stays available to every aws
destination rather than falling back to downloading each load file. A static
key destination now sends a credential that expires rather than the
customer's long-term secret, which is the same trade the other three make.

minio keeps reading its own keys: it has no STS to mint from. The token is
omitted from the statement when there is none, so that path sends the six
arguments it always sent. v1 keeps skipping the engine for rudder storage
instead: it has no temporary credential path, and runs against clickhouse 21,
which predates the argument entirely.

credentials() also errors on empty keys rather than interpolating them, so a
misconfigured destination fails with a message that names the cause, and the
query-log mask widens to cover a third credential argument.

The load round trip gains a case that reaches the same minio bucket as an aws
destination, minting from minio's own STS so the session token the statement
carries is one the bucket actually validates.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pXCMMrSLnt63xCWqvXhQ4

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr force-pushed the fix.ch-v2-s3-rudder-storage branch from 22fa6d1 to df41f64 Compare September 8, 2026 08:50
@codecov

codecov Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.30435% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.28%. Comparing base (72390f6) to head (f77b689).
⚠️ Report is 1 commits behind head on release/1.86.x.

Files with missing lines Patch % Lines
warehouse/integrations/clickhouse/clickhouse.go 0.00% 1 Missing and 1 partial ⚠️
warehouse/integrations/clickhouse/load_v2.go 95.34% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           release/1.86.x    #7353      +/-   ##
==================================================
+ Coverage           79.92%   80.28%   +0.36%     
==================================================
  Files                 615      615              
  Lines               69166    69184      +18     
==================================================
+ Hits                55279    55544     +265     
+ Misses              10642    10377     -265     
- Partials             3245     3263      +18     

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

@achettyiitr
achettyiitr merged commit c835fc0 into release/1.86.x Sep 9, 2026
72 checks passed
@achettyiitr
achettyiitr deleted the fix.ch-v2-s3-rudder-storage branch September 9, 2026 10:40
achettyiitr pushed a commit that referenced this pull request Sep 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.86.1](v1.86.0...v1.86.1)
(2026-09-09)


### Bug Fixes

* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([6456c64](6456c64))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([c835fc0](c835fc0))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([3a1407c](3a1407c))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([72390f6](72390f6))

---
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>
atzoum pushed a commit that referenced this pull request Sep 9, 2026
# Description

Syncing patch release v1.86.1 to main branch

**↓↓ Please review and edit commit overrides before merging ↓↓**

BEGIN_COMMIT_OVERRIDE
fix(warehouse): retire idle clickhouse v2 connections (#7352)
fix(warehouse): retry a failed clickhouse v2 block (#7354)
fix(warehouse): pass temporary credentials to the clickhouse v2 s3 copy
engine (#7353)
fix(warehouse): instrument the clickhouse v2 load path (#7355)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Akash Chetty <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.1](v1.86.0...v1.87.0-rc.1)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 14, 2026
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.2](v1.86.0...v1.87.0-rc.2)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 14, 2026
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.3](v1.86.0...v1.87.0-rc.3)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 15, 2026
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.4](v1.86.0...v1.87.0-rc.4)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0](v1.86.0...v1.87.0)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

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