Skip to content

Backport #107357 to 26.3: Avoid storing S3 credentials in backup metadata - #108918

Merged
pamarcos merged 2 commits into
26.3from
backport/26.3/107357
Jun 30, 2026
Merged

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

  • Merged into: 26.3.17.10

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

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 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> through BackupInfo::withoutS3Credentials, and write a non-secret marker when restore-time credential copying from the main backup locator is sufficient.
  • Avoid mutating stored base_backup_info when use_same_s3_credentials_for_base_backup is enabled by copying credentials into a local effective locator only for opening the base backup.
  • Add external_id support 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.

@pamarcos
pamarcos merged commit 9609a0d into 26.3 Jun 30, 2026
35 checks passed
@pamarcos
pamarcos deleted the backport/26.3/107357 branch June 30, 2026 16:29
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