Repository navigation
Backport #107357 to 26.5: Avoid storing S3 credentials in backup metadata - #108920
Merged
Merged
Conversation
robot-clickhouse
force-pushed
the
backport/26.5/107357
branch
from
June 30, 2026 10:52
46cf88b to
2b3c7af
Compare
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.
Contributor
There was a problem hiding this comment.
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::withoutS3Credentialsand metadata-writing logic to serialize base backup locators without inlineS3credentials, 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
S3auth support withexternal_id(STS AssumeRoleExternalId) 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. |
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.
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
26.5.5.13