Skip to content

More security validations for biglake catalog - #105117

Merged
scanhex12 merged 3 commits into
ClickHouse:masterfrom
scanhex12:fix-biglake-metadata-ssrf
May 19, 2026
Merged

scanhex12 merged 3 commits into
ClickHouse:masterfrom
scanhex12:fix-biglake-metadata-ssrf

Conversation

@scanhex12

@scanhex12 scanhex12 commented May 16, 2026 •

Copy link
Copy Markdown
Member

Closes: https://github.com/ClickHouse/clickhouse-private/issues/52499
Closes: https://github.com/ClickHouse/clickhouse-private/issues/57919

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

More security validations for biglake catalog

Version info

  • Merged into: 26.5.1.828 (included in 26.5 and later)
  • Backported to: 26.3.33.100

@clickhouse-gh

clickhouse-gh Bot commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [61cbd2a]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted) FAIL
Logical error: Unexpected format for file: A (STID: 3160-3c8c) FAIL cidb
Integration tests (amd_asan_ubsan, flaky) ERROR

AI Review

Summary

This PR hardens BigLake auth flows by adding metadata-host allow-list checks and host filtering before outbound token requests. One security contract is still violated: configured ADC auth can still silently fall back to metadata-service auth on ADC exceptions. The PR also lacks focused regression coverage for the new allow-list behavior. Verdict: request changes.

Findings

❌ Blockers

  • [src/Databases/DataLake/RestCatalog.cpp:467] retrieveGoogleCloudAccessToken catches DB::Exception from retrieveGoogleCloudAccessTokenFromRefreshToken and then falls through to metadata-service auth. This can silently switch identity from configured ADC credentials to metadata-service credentials instead of failing closed.
    Suggested fix: when ADC settings are present, propagate ADC exceptions; only allow fallback behind an explicit opt-in setting disabled by default.

⚠️ Majors

  • [tests/integration/test_e2e_catalogs/test.py:195] The test change only injects biglake_metadata_hosts.xml into fixture config and does not validate the new allow-list contract.
    Suggested fix: add focused integration tests that prove rejection when iceberg_biglake_metadata_service_hosts is absent/empty, rejection for disallowed google_metadata_service, and success for an allowed host.
Tests
  • ⚠️ Missing focused regression coverage for the metadata-host allow-list behavior introduced by this PR.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
  1. Make ADC authentication fail closed (or explicitly gate fallback behavior).
  2. Add targeted tests for allow-list reject/accept cases.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label May 16, 2026
const auto & context = getContext();

const auto allowed_metadata_hosts = getAllowedBigLakeMetadataServiceHosts(context->getConfigRef());
if (allowed_metadata_hosts.empty())

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.

retrieveGoogleCloudAccessToken still falls back to metadata-service auth on any retrieveGoogleCloudAccessTokenFromRefreshToken exception. That means explicitly configured ADC credentials can silently switch identity source (to instance metadata credentials) instead of failing closed.

Given this PR is hardening security boundaries, please avoid this implicit fallback when ADC settings are present: propagate the ADC exception (or gate fallback behind an explicit setting) so a bad/expired ADC config cannot transparently change the auth principal.

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.

Rechecked at current PR head: retrieveGoogleCloudAccessToken still catches any DB::Exception from retrieveGoogleCloudAccessTokenFromRefreshToken and then falls through to metadata-service auth.

That still violates fail-close behavior for explicitly configured ADC credentials: an ADC failure can silently switch the auth principal to metadata credentials. Please either propagate the ADC error when ADC settings are present, or guard this fallback behind an explicit setting disabled by default.

"node1",
main_configs=["configs/merge_tree.xml"],
main_configs=["configs/merge_tree.xml", "configs/biglake_metadata_hosts.xml"],
user_configs=["configs/allow_experimental.xml"],

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.

This change adds security-critical behavior (iceberg_biglake_metadata_service_hosts allow-list + host checks), but the test change only injects config into the cluster fixture. It does not validate the new contract.

Please add a focused regression test that proves at least:

  1. metadata requests are rejected when the allow-list is absent/empty;
  2. google_metadata_service values outside the allow-list are rejected;
  3. an allowed host still works.

Without that, this hardening path can regress silently.

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.

Rechecked at current PR head: this test change still only injects config in the fixture and does not validate the new allow-list contract.

Please add focused integration coverage for the hardening behavior: metadata requests are rejected when iceberg_biglake_metadata_service_hosts is absent/empty, rejected for a disallowed google_metadata_service, and accepted for an allowed host.

Comment thread src/Databases/DataLake/RestCatalog.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

This was fixed by #105146. Let's update the branch.

@Fgrtue Fgrtue self-assigned this May 18, 2026

@grantholly-clickhouse grantholly-clickhouse 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.

One small find by the bot, but otherwise LGTM

Comment thread src/Databases/DataLake/RestCatalog.cpp Resolved
@scanhex12
scanhex12 force-pushed the fix-biglake-metadata-ssrf branch from f8be8ec to 61cbd2a Compare May 19, 2026 07:55
@clickhouse-gh

clickhouse-gh Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.20% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: 2.70% (1/37) · Uncovered code

Full report · Diff report

@scanhex12
scanhex12 enabled auto-merge May 19, 2026 11:24
@scanhex12
scanhex12 added this pull request to the merge queue May 19, 2026
@scanhex12
scanhex12 removed this pull request from the merge queue due to a manual request May 19, 2026
@scanhex12
scanhex12 added this pull request to the merge queue May 19, 2026
Merged via the queue into ClickHouse:master with commit 4144204 May 19, 2026
162 of 165 checks passed
@scanhex12
scanhex12 deleted the fix-biglake-metadata-ssrf branch May 19, 2026 13:49
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label May 19, 2026
@rschu1ze rschu1ze added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Sep 14, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 14, 2026
robot-clickhouse-ci-2 added a commit that referenced this pull request Sep 17, 2026
Cherry pick #105117 to 26.3: More security validations for biglake catalog
PedroTadim added a commit that referenced this pull request Sep 17, 2026
Resolutions:
- `src/Databases/DataLake/RestCatalog.cpp`: kept only the
  `Poco/Util/AbstractConfiguration.h` include the cherry-pick adds;
  `Common/FailPoint.h` is unrelated master drift and nothing in this file uses
  it on 26.3.
- `tests/integration/test_e2e_catalogs/`: dropped the `test.py` edit and the
  new `configs/biglake_metadata_hosts.xml`. The whole test directory does not
  exist on 26.3, so there is nothing for the edit to apply to and the config
  would be unreferenced.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 17, 2026
PedroTadim added a commit that referenced this pull request Sep 17, 2026
Backport #105117 to 26.3: More security validations for biglake catalog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants