Repository navigation
Backport #107357 to 26.4: Avoid storing S3 credentials in backup metadata - #108919
Merged
Merged
Conversation
robot-clickhouse
force-pushed
the
backport/26.4/107357
branch
from
June 30, 2026 10:51
ae618b1 to
d60c013
Compare
Contributor
|
Workflow [BackportPR], commit [b7dd512] 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
Backport of upstream change ensuring incremental backup metadata never persists S3 credentials in the <base_backup> locator inside the .backup metadata file, while keeping restore compatibility for older backups.
Changes:
- Update backup metadata writing/reading so base backup locators are serialized via
BackupInfo::withoutS3Credentials, optionally emitting a non-secret marker to copy inline credentials from the restore source when applicable. - Extend
S3auth plumbing to supportexternal_id(named collections, extra credentials parsing, STS AssumeRole request and provider cache key, backup engine and disk settings). - Add/adjust tests: new stateless query test for
.backupmetadata redaction + backward compatibility scenario; new gtest coverage forBackupInfo::withoutS3Credentials; simplify existinguse_same_s3_credentials_for_base_backupquery test expectations.
Reviewed changes
Copilot reviewed 17 out of 17 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 base-backup metadata does not contain S3 credentials, plus backward compatibility via metadata rewrite. |
tests/queries/0_stateless/04327_backup_s3_base_credentials_metadata.reference |
Expected output for the new stateless test (tag/marker presence + credential redaction checks). |
tests/queries/0_stateless/02843_backup_use_same_s3_credentials_for_base_backup.sh |
Removes older “invalid base creds embedded in metadata” behavior checks that no longer apply. |
tests/queries/0_stateless/02843_backup_use_same_s3_credentials_for_base_backup.reference |
Updates expected output to match the adjusted test flow. |
src/Storages/ObjectStorage/S3/Configuration.cpp |
Adds external_id support in named collection parsing and credential argument collection. |
src/IO/S3AuthSettings.cpp |
Declares new auth setting external_id. |
src/IO/S3/Credentials.h |
Threads external_id through STS assume-role request/provider data structures. |
src/IO/S3/Credentials.cpp |
Implements ExternalId query parameter emission and includes it in assume-role provider cache key + creation path. |
src/Disks/DiskObjectStorage/ObjectStorages/S3/diskSettings.cpp |
Passes external_id into S3::CredentialsConfiguration for disk S3 clients. |
src/Backups/tests/gtest_backup_info.cpp |
New unit tests for BackupInfo::withoutS3Credentials (positional creds, kv creds, URL redaction, expression evaluation w/ context, idempotency, etc.). |
src/Backups/registerBackupEngineS3.cpp |
Wires external_id through backup engine S3 creation and named collection reading. |
src/Backups/BackupIO_S3.h |
Extends reader/writer ctor signatures to accept external_id. |
src/Backups/BackupIO_S3.cpp |
Propagates external_id into makeS3Client and underlying credential configuration selection. |
src/Backups/BackupInfo.h |
Adds canCopyS3CredentialsTo and withoutS3Credentials API used for safe metadata serialization. |
src/Backups/BackupInfo.cpp |
Implements URL credential redaction and removal of inline S3 credential arguments (positional, kv, extra credentials), with optional context-based evaluation. |
src/Backups/BackupImpl.h |
Adds boolean tracking for the new “copy creds from restore source” marker in metadata. |
src/Backups/BackupImpl.cpp |
Ensures base-backup opening uses an “effective” copy of base locator creds (not persisted), writes redacted base locator + optional marker, and reads marker when base locator comes from metadata. |
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 #108842
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.4.5.90