Skip to content

staging-v25.4.8: importer: sanitize cloud storage URIs in error messages#168040

Merged
rail merged 1 commit intocockroachdb:staging-v25.4.8from
rail:backportstaging-v25.4.8-167949
Apr 9, 2026
Merged

staging-v25.4.8: importer: sanitize cloud storage URIs in error messages#168040
rail merged 1 commit intocockroachdb:staging-v25.4.8from
rail:backportstaging-v25.4.8-167949

Conversation

@rail
Copy link
Copy Markdown
Member

@rail rail commented Apr 9, 2026

Backport 1/1 commits from #167949.

/cc @cockroachdb/release


Backport 1/1 commits from #164881 on behalf of @mw5h.


Summary

  • Sanitize cloud storage URIs in readInputFiles error messages using
    cloud.SanitizeExternalStorageURI to strip credentials before including
    them in user-visible errors.
  • Fixes three error paths: the "too many parsing errors" pgerror and both
    errors.Wrapf calls that annotate errors with the file path.

Resolves: #151884

Release note (bug fix): Fixed a bug where IMPORT error messages
could include unredacted cloud storage credentials from the source
URI. Credentials are now stripped from URIs before they appear in
error messages.


Release justification: Important security fix for an issue encountered by a customer.

Release justification:

Previously, when an import job failed, error messages in
`readInputFiles` included the full cloud storage URI which could
contain credentials (e.g., `CREDENTIALS=<secret>`). The code already
acknowledged this risk with a comment ("Don't log dataFile here because
it could leak auth information") but the error return paths were not
similarly protected.

Use `cloud.SanitizeExternalStorageURI` to strip credentials from the
data file URI before including it in error messages, following the same
pattern as the backup code's `RedactURIForErrorMessage`. This covers
the three error paths in `readInputFiles` that explicitly embed the
file path: the `pgerror.Newf` for "too many parsing errors" and both
`errors.Wrapf` calls that annotate errors with the file path.

Resolves: cockroachdb#151884

Release note (bug fix): Fixed a bug where IMPORT error messages
could include unredacted cloud storage credentials from the source
URI. Credentials are now stripped from URIs before they appear in
error messages.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@rail rail requested a review from a team as a code owner April 9, 2026 14:53
@rail rail requested review from ZhouXing19 and removed request for a team April 9, 2026 14:53
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Apr 9, 2026

Thanks for opening a backport.

Before merging, please confirm that it falls into one of the following categories (select one):

  • Non-production code changes OR fixes for serious issues. Non-production includes test-only changes, build system changes, etc. Serious issues are defined in the policy as correctness, stability, or security issues, data corruption/loss, significant performance regressions, breaking working and widely used functionality, or an inability to detect and debug production issues.
  • Other approved changes. These changes must be gated behind a disabled-by-default feature flag unless there is a strong justification not to. Reference the approved ENGREQ ticket in the PR body (e.g., "Fixes ENGREQ-123").

Add a brief release justification to the PR description explaining your selection.

Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy.

All backports must be reviewed by the TL and EM for the owning area.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team labels Apr 9, 2026
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Apr 9, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rail rail requested a review from mw5h April 9, 2026 14:57
@rail rail merged commit 466b1cd into cockroachdb:staging-v25.4.8 Apr 9, 2026
18 checks passed
@rail rail deleted the backportstaging-v25.4.8-167949 branch April 9, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team v25.4.8

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants