Skip to content

Backport #107357 to 26.5: Avoid storing S3 credentials in backup metadata - #108920

Merged
pamarcos merged 2 commits into
26.5from
backport/26.5/107357
Jul 1, 2026
Merged

pamarcos merged 2 commits into
26.5from
backport/26.5/107357

Conversation

@robot-ch-test-poll3

@robot-ch-test-poll3 robot-ch-test-poll3 commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@robot-ch-test-poll3 robot-ch-test-poll3 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 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [9ceb077]

Summary: ✅

The backup metadata backport can leave `external_id` in `extra_credentials`, but
older branches did not accept or forward it through `S3` auth settings. Add the
missing plumbing and align `02843` with current restore behavior.

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

This backport hardens ClickHouse incremental S3 backups by ensuring backup metadata (.backup) does not persist S3 credentials in the <base_backup> locator, while keeping restore behavior workable via a non-secret marker when credentials can be safely copied from the restore source.

Changes:

  • Add BackupInfo::withoutS3Credentials and metadata-writing logic to serialize base backup locators without inline S3 credentials, optionally emitting a <base_backup_copy_s3_credentials_from_backup> marker.
  • Adjust restore-time base-backup opening to honor the marker by copying credentials from the restore source locator when possible, without mutating stored base_backup_info.
  • Extend S3 auth support with external_id (STS AssumeRole ExternalId) and add unit + query tests covering credential stripping and compatibility.

Reviewed changes

Copilot reviewed 18 out of 18 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 query test validating .backup base locator redaction, marker behavior, and backward compatibility.
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 metadata-credential dependency checks that no longer apply after credential stripping.
tests/queries/0_stateless/02843_backup_use_same_s3_credentials_for_base_backup.reference Updates expected output to match the adjusted test behavior.
src/Storages/ObjectStorage/S3/Configuration.cpp Plumbs external_id through named collections and extra_credentials.
src/IO/S3AuthSettings.cpp Adds external_id to S3AuthSettings.
src/IO/S3/Credentials.h Extends credential configuration and STS AssumeRole request/provider to carry external_id.
src/IO/S3/Credentials.cpp Implements sending ExternalId to STS and includes it in credential-provider cache keys.
src/Disks/DiskObjectStorage/ObjectStorages/S3/diskSettings.cpp Passes external_id into S3::CredentialsConfiguration.
src/Coordination/KeeperSnapshotManagerS3.cpp Passes external_id into snapshot S3 client credential configuration.
src/Backups/tests/gtest_backup_info.cpp New unit tests for BackupInfo::withoutS3Credentials and credential-copy invariants.
src/Backups/registerBackupEngineS3.cpp Reads external_id from named collections / extra_credentials for backup engine S3.
src/Backups/BackupIO_S3.h Extends backup reader/writer constructors to accept external_id.
src/Backups/BackupIO_S3.cpp Threads external_id through S3 client creation for backup IO.
src/Backups/BackupInfo.h Declares canCopyS3CredentialsTo and withoutS3Credentials.
src/Backups/BackupInfo.cpp Implements stripping/redaction of S3 credentials and URL credential material.
src/Backups/BackupImpl.h Stores restore-time marker state for copying credentials from the restore source.
src/Backups/BackupImpl.cpp Ensures base backup credentials aren’t persisted; writes/reads marker and uses it at restore time.

@pamarcos
pamarcos merged commit f29687d into 26.5 Jul 1, 2026
35 checks passed
@pamarcos
pamarcos deleted the backport/26.5/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