Skip to content

Backport #107357 to 26.4: Avoid storing S3 credentials in backup metadata - #108919

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

pamarcos merged 2 commits into
26.4from
backport/26.4/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 #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

  • Merged into: 26.4.5.90

@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 [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.

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 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 S3 auth plumbing to support external_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 .backup metadata redaction + backward compatibility scenario; new gtest coverage for BackupInfo::withoutS3Credentials; simplify existing use_same_s3_credentials_for_base_backup query 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.

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