Repository navigation
fix(warehouse): keep snowflake copy credentials out of logs - #7442
Merged
Merged
Conversation
The identity mappings COPY statement was logged verbatim at info level, and again on failure, including the AWS temporary credentials carried by its CREDENTIALS clause. The identity merge rules COPY and the SQL middleware already masked them; this path did not. Share one copyCredentialsRegex between the middleware and every direct COPY log, and build the clause through awsCredentialsClause so the test masks the real format. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ntil it runs Masking at each log call only works while every caller remembers to do it. Build every COPY statement as a copyStatement instead: its SQL carries a placeholder for the auth clause, which is only put in place when the statement is handed to the database. Logging the statement, through String or any fmt verb, prints the placeholder, so no log call site can leak the credentials by forgetting to mask. newCopyStatement is the only place the auth clause is built, and it rejects a template whose placeholder does not appear exactly once. The middleware keeps masking with copyCredentialsRegex, since it sees the final statement. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pure move: copyStatement, its constructors and the credentials clause and regex it relies on now live in copy_statement.go, next to their test. No code changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Replace the placeholder template with a function that formats the COPY statement around a given auth clause. newCopyStatement calls it twice: once with the real clause, which only goes to the database, and once with the credentials masked, which is what the statement logs as. The auth clause is now an ordinary formatting argument, so the placeholder, its substitution and the check that guarded against a value carrying a copy of it all go away. A storage integration name is not a secret, so logs show it again. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7442 +/- ##
==========================================
+ Coverage 84.49% 84.97% +0.48%
==========================================
Files 622 623 +1
Lines 62060 62056 -4
==========================================
+ Hits 52435 52734 +299
+ Misses 9622 9319 -303
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
achettyiitr
approved these changes
Oct 5, 2026
maheshkutty
approved these changes
Oct 5, 2026
This was referenced Oct 12, 2026
Merged
mihir20
pushed a commit
that referenced
this pull request
Oct 12, 2026
🤖 I have created a release *beep* *boop* --- ## [1.90.0-rc.1](v1.89.0...v1.90.0-rc.1) (2026-10-12) ### Features * **processor:** add source_out reporting metric ([#7435](#7435)) ([909fba9](909fba9)) * **processor:** allow disabling event schemas v2 per source ([#7429](#7429)) ([a8c12b2](a8c12b2)) * **processor:** report dest_transformer diff rows for multiplexing destination transformations ([#7446](#7446)) ([cd95c32](cd95c32)) * **processor:** report dest_transformer succeeded for destinations without a destination transformation ([#7445](#7445)) ([21f7e41](21f7e41)) * **processor:** report user_transformer succeeded for destinations without a user transformation ([#7440](#7440)) ([f424257](f424257)) * **router:** mask live events destination credentials ([#7460](#7460)) ([5fa5fe2](5fa5fe2)) * **warehouse:** add Microsoft Fabric destination ([#7441](#7441)) ([74940c2](74940c2)) ### Bug Fixes * **batchrouter:** do not abort warehouse jobs on a zero failure timestamp ([#7426](#7426)) ([506f6d5](506f6d5)) * **batchrouter:** recover snowpipe streaming channels for tables dropped externally ([#7434](#7434)) ([93cd81d](93cd81d)) * **destination:** encode Lytics bulk upload URL values ([#7433](#7433)) ([08e6937](08e6937)) * **destination:** retry bqstream transport failures ([#7464](#7464)) ([cd3dc3e](cd3dc3e)) * **warehouse:** cap deltalake validation schema describes ([#7444](#7444)) ([d119779](d119779)) * **warehouse:** keep snowflake copy credentials out of logs ([#7442](#7442)) ([f91747b](f91747b)) * **warehouse:** set explicit lineSep for deltalake csv copy ([#7455](#7455)) ([cc22d18](cc22d18)) ### Miscellaneous * migrate self-hosted arm64 docker build runners to gha-runner-scale-set ([#7425](#7425)) ([5cdffde](5cdffde)) * **processor:** retire the destination-filter reorder, dedup and gw_ingested reporting flags ([#7450](#7450)) ([1040511](1040511)) * pull openapi-generator through the ECR pull-through cache ([#7449](#7449)) ([6e9f920](6e9f920)) --- 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
Oct 13, 2026
🤖 I have created a release *beep* *boop* --- ## [1.90.0](v1.89.0...v1.90.0) (2026-10-12) ### Features * **processor:** add source_out reporting metric ([#7435](#7435)) ([909fba9](909fba9)) * **processor:** allow disabling event schemas v2 per source ([#7429](#7429)) ([a8c12b2](a8c12b2)) * **processor:** report dest_transformer diff rows for multiplexing destination transformations ([#7446](#7446)) ([cd95c32](cd95c32)) * **processor:** report dest_transformer succeeded for destinations without a destination transformation ([#7445](#7445)) ([21f7e41](21f7e41)) * **processor:** report user_transformer succeeded for destinations without a user transformation ([#7440](#7440)) ([f424257](f424257)) * **router:** mask live events destination credentials ([#7460](#7460)) ([5fa5fe2](5fa5fe2)) * **warehouse:** add Microsoft Fabric destination ([#7441](#7441)) ([74940c2](74940c2)) ### Bug Fixes * **batchrouter:** do not abort warehouse jobs on a zero failure timestamp ([#7426](#7426)) ([506f6d5](506f6d5)) * **batchrouter:** recover snowpipe streaming channels for tables dropped externally ([#7434](#7434)) ([93cd81d](93cd81d)) * **destination:** encode Lytics bulk upload URL values ([#7433](#7433)) ([08e6937](08e6937)) * **destination:** retry bqstream transport failures ([#7464](#7464)) ([cd3dc3e](cd3dc3e)) * **warehouse:** cap deltalake validation schema describes ([#7444](#7444)) ([d119779](d119779)) * **warehouse:** keep snowflake copy credentials out of logs ([#7442](#7442)) ([f91747b](f91747b)) * **warehouse:** set explicit lineSep for deltalake csv copy ([#7455](#7455)) ([cc22d18](cc22d18)) ### Miscellaneous * migrate self-hosted arm64 docker build runners to gha-runner-scale-set ([#7425](#7425)) ([5cdffde](5cdffde)) * **processor:** retire the destination-filter reorder, dedup and gw_ingested reporting flags ([#7450](#7450)) ([1040511](1040511)) * pull openapi-generator through the ECR pull-through cache ([#7449](#7449)) ([6e9f920](6e9f920)) --- 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a Snowflake destination loads from S3 with temporary AWS credentials (RudderStack-managed object storage, or AWS without a storage integration), the
COPYstatement carries them in aCREDENTIALS = (AWS_KEY_ID='…' AWS_SECRET_KEY='…' AWS_TOKEN='…')clause.The identity-mappings load logged that statement verbatim twice, which printed the credentials in plaintext:
Copying identity mappings for table(info)Error running COPY for table(error, on failure)The rest of the integration masked the credentials, but only because each call site remembered to do it. The identity merge-rules log ran its own regex, and this path didn't.
Approach
This PR removes the "remember to mask" requirement instead of adding one more masked call site. Every COPY statement is built from a function that formats it around a given auth clause:
sf.newCopyStatementcalls the function twice and keeps both results:String()returnsloggableSQL, so%v,%s,%+vand%#v(viaGoString) printCREDENTIALS = (AWS_KEY_ID='***' AWS_SECRET_KEY='***' AWS_TOKEN='***').secretSQLis only passed to the database byexecContext/queryContext.sf.newCopyStatementis the only place the auth clause is built. It replacesauthString(), so the credentials never exist as a plain string that could be pasted into SQL.copyCredentialsRegex, because it seessecretSQL. That regex is now one shared map instead of two inline copies, and a test checks that its output matches the logged form.All four COPY paths use the new builder: load table, identity merge rules, identity mappings, and
TestLoadTable. The type lives incopy_statement.go.Why not the Redshift pattern (regex-mask at each log call)? That is what this PR first did. It still depends on every future log site masking, and a
'[^']*'pattern stops at the first quote inside a value. Here the logged form is built with masked values from the start.Follow-up (not in this PR): Redshift, Deltalake and ClickHouse build credential-bearing SQL the same way and could move to this pattern.
Linear Ticket
N/A
Security
🤖 Generated with Claude Code