Skip to content

Backport #107357 to 25.8: Avoid storing S3 credentials in backup metadata - #108847

Merged
pamarcos merged 4 commits into
25.8from
backport/25.8/107357
Jul 1, 2026
Merged

pamarcos merged 4 commits into
25.8from
backport/25.8/107357

Conversation

@robot-clickhouse-ci-2

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #107357
Cherry-pick pull-request #108840

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 25.8.26.8

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Jun 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [bc0ec9f]

Use `std::make_shared` instead of unavailable `make_intrusive` on 25.8.

CI: #108847

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backport of the upstream fix to prevent incremental backup metadata (.backup) from persisting S3 credentials in the serialized <base_backup> locator, while preserving backward compatibility for older metadata that did embed credentials.

Changes:

  • Add BackupInfo::withoutS3Credentials() (with optional Context) and canCopyS3CredentialsTo() to support credential stripping and safe “copy credentials” checks.
  • Update BackupImpl to (a) avoid mutating/storing credential-copied base_backup_info, (b) serialize base-backup locators with credentials removed, and (c) emit/consume a non-secret metadata marker to copy inline credentials at restore time when safe.
  • Add unit and query tests covering URL redaction, expression evaluation, marker behavior, and backward compatibility.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/queries/0_stateless/04327_backup_s3_base_credentials_metadata.sh New stateless test validating that <base_backup> metadata doesn’t contain S3 credentials and that restores behave correctly (including backward-compat).
tests/queries/0_stateless/04327_backup_s3_base_credentials_metadata.reference Expected output for the new stateless test.
tests/queries/0_stateless/02843_backup_use_same_s3_credentials_for_base_backup.sh Removes old test logic that relied on credentials being stored in metadata.
src/Backups/tests/gtest_backup_info.cpp New gtest coverage for withoutS3Credentials() redaction and expression evaluation behavior.
src/Backups/BackupInfo.h Declares canCopyS3CredentialsTo() and withoutS3Credentials().
src/Backups/BackupInfo.cpp Implements S3 credential stripping (positional, key-value, extra_credentials, URL userinfo/presign params) and copy-eligibility check.
src/Backups/BackupImpl.h Adds a flag to honor the new restore-time credential copy marker from metadata.
src/Backups/BackupImpl.cpp Ensures .backup serialization never persists base-backup S3 credentials; adds marker write/read and restore-time copying logic without mutating stored base_backup_info.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Accept `external_id` in `S3` `extra_credentials` and pass it to STS assume-role credentials so `04327` succeeds on the `25.8` backport.

Also align `02843` with current restore behavior by removing the stale restore failure expectation.

PR: #108847

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

Pass `external_id` to the remaining `BackupReaderS3` construction in read mode after adding the constructor parameter.

PR: #108847

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

@pamarcos
pamarcos merged commit 6d84428 into 25.8 Jul 1, 2026
32 of 35 checks passed
@pamarcos
pamarcos deleted the backport/25.8/107357 branch July 1, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants