Repository navigation
Backport #107357 to 26.3: Avoid storing S3 credentials in backup metadata - #108918
Merged
Merged
Conversation
Contributor
|
Workflow [BackportPR], commit [0f865eb] 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 so .backup metadata never persists S3 credentials inside the <base_backup> locator, while preserving restore compatibility and adding coverage for credential redaction behavior.
Changes:
- Serialize
<base_backup>throughBackupInfo::withoutS3Credentials, and write a non-secret marker when restore-time credential copying from the main backup locator is sufficient. - Avoid mutating stored
base_backup_infowhenuse_same_s3_credentials_for_base_backupis enabled by copying credentials into a local effective locator only for opening the base backup. - Add
external_idsupport for STS AssumeRole credentials flow and expand tests (stateless + gtest) to verify redaction and compatibility.
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 coverage ensuring base-backup locators in .backup don’t contain credentials and that old metadata remains restorable. |
| 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 legacy assertion that relied on credentials being stored in base-backup metadata. |
| tests/queries/0_stateless/02843_backup_use_same_s3_credentials_for_base_backup.reference | Updates expected output accordingly. |
| src/Storages/ObjectStorage/S3/Configuration.cpp | Adds external_id parsing/support in S3 named-collection/config credential handling. |
| src/IO/S3AuthSettings.cpp | Registers external_id as an S3 auth setting. |
| src/IO/S3/Credentials.h | Extends STS AssumeRole request/provider interfaces to carry external_id. |
| src/IO/S3/Credentials.cpp | Sends ExternalId in STS requests when provided; includes it in provider cache keying. |
| src/Disks/DiskObjectStorage/ObjectStorages/S3/diskSettings.cpp | Threads external_id into S3::CredentialsConfiguration for disk-based S3 clients. |
| src/Backups/tests/gtest_backup_info.cpp | Adds unit tests for BackupInfo::withoutS3Credentials redaction (including expression evaluation with context) and credential-copy invariants. |
| src/Backups/registerBackupEngineS3.cpp | Reads external_id from named collections / auth args for the backup engine S3 path. |
| src/Backups/BackupIO_S3.h | Extends backup reader/writer constructors to accept external_id. |
| src/Backups/BackupIO_S3.cpp | Propagates external_id into S3 client construction for backup IO. |
| src/Backups/BackupInfo.h | Adds canCopyS3CredentialsTo and withoutS3Credentials APIs. |
| src/Backups/BackupInfo.cpp | Implements credential stripping/redaction for S3 locators, including URL credential/query redaction and safe handling of expression keys/values via context. |
| src/Backups/BackupImpl.h | Adds state for the restore-time “copy credentials from backup locator” marker. |
| src/Backups/BackupImpl.cpp | Writes redacted base-backup locators + marker; honors marker on restore while keeping stored base_backup_info immutable. |
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 #108841
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.3.17.10