Skip to content

Antalya 26.6: Forward auth tokens to data lake catalogs - #2329

Open
zvonand wants to merge 6 commits into
antalya-26.6from
feature/antalya-26.6/aouth-forward-to-datalake
Open

zvonand wants to merge 6 commits into
antalya-26.6from
feature/antalya-26.6/aouth-forward-to-datalake

Conversation

@zvonand

@zvonand zvonand commented Sep 8, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

Forward auth tokens to data lake catalogs

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

@zvonand zvonand added antalya-26.6 port-antalya PRs to be ported to all new Antalya releases labels Sep 8, 2026
@zvonand
zvonand force-pushed the feature/antalya-26.6/aouth-forward-to-datalake branch from 5d6ced1 to 33ba90f Compare September 9, 2026 06:48
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Workflow [PR], commit [f2ed7c3]

@zvonand
zvonand force-pushed the feature/antalya-26.6/aouth-forward-to-datalake branch from 4acc349 to b5f1b30 Compare September 9, 2026 20:59
@hpcnt-stewart

Copy link
Copy Markdown

cool

@zvonand

zvonand commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

Add support for amazon SSO

@zvonand
zvonand force-pushed the feature/antalya-26.6/aouth-forward-to-datalake branch from dadc31f to 37a108b Compare September 21, 2026 12:15
A `DataLakeCatalog` database contacted its catalog as one shared service
identity, so the catalog could not see, authorize or audit the human behind a
query, and every ClickHouse user got identical catalog and storage access.

With `oauth_forward_user_token = 1` the catalog is contacted as the user
running the query. It requires the server-level `enable_token_forwarding`
setting -- off by default, and re-read on every forwarded request, so turning
it off stops already-authenticated sessions from forwarding -- and users who
authenticated with a token (`Authorization: Bearer`, or `--jwt` on the native
protocol). The token is carried on the session and copied into the query
context. There is no service session to fall back to: a query without a token
fails with `CATALOG_USER_TOKEN_NOT_AVAILABLE` instead of reaching the catalog
as the service principal.

How the token is used depends on the catalog type; the setting is rejected for
every other type rather than silently ignored:

- An Iceberg REST catalog takes bearer tokens directly, optionally after an
  RFC 8693 exchange at `oauth_token_exchange_uri`, with
  `oauth_subject_token_type` / `oauth_requested_token_type` describing the
  token and `oauth_forward_actor_token` sending the service principal's own
  token as the `actor_token` for delegation. Exchanged session tokens and the
  credentials the catalog vends are cached per user, bounded by
  `oauth_user_token_cache_ttl` and `vended_credentials_cache_ttl`.

- Glue authenticates with AWS SigV4 and takes no bearer token, so the token
  goes to AWS STS instead: `AssumeRoleWithWebIdentity` against `aws_role_arn`
  returns temporary credentials that sign every Glue request and the S3 reads
  that follow, with the ClickHouse user name as the `RoleSessionName`. The
  Glue client and its credentials provider are built per user and cached on
  the token fingerprint, so one user is never handed another's session.
  `CREATE DATABASE` rejects the combinations that could not be honoured:
  forwarding without `aws_role_arn`, with static `aws_access_key_id` /
  `aws_secret_access_key`, or with `oauth_token_exchange_uri`.

Rotating credentials with `ALTER DATABASE ... MODIFY SETTING
catalog_credential` is carried out as the calling user when forwarding is on,
and an `auth_generation` counter scopes every cached token and vended
credential to the credentials it was minted under, so a request that
authenticated before the ALTER cannot put a rotated-away artifact back into
the caches. A lazy `/v1/config` load racing with the same ALTER is dropped
rather than republishing the credentials it started with.

An asynchronous insert keeps the token verified when it was pushed and flushes
under it; the token's fingerprint takes part in the queue key, so inserts
authenticated with different tokens never share a batch.

Tests: the `test_datalake_token_forwarding`,
`test_datalake_glue_token_forwarding` and `test_datalake_sso_lakekeeper`
(Keycloak with Lakekeeper) integration suites;
`gtest_rest_catalog_token_forwarding` and
`gtest_sts_assume_role_with_web_identity` unit tests; the
`05027_datalake_token_forwarding_masking`,
`05028_datalake_token_forwarding_fail_closed` and
`05053_glue_token_forwarding_validation` stateless tests.
@zvonand
zvonand force-pushed the feature/antalya-26.6/aouth-forward-to-datalake branch from 37a108b to 1072cc3 Compare September 21, 2026 12:21
Remove commentary that restates the code and keep concise explanations of
credential lifetime, publication ordering, and test synchronization.

Consolidate exchange and STS assertions, remove duplicate integration cases,
and drop checks that do not exercise token expiry or rotation. Retain user
isolation, credential-rotation races, async token lifetime, and fail-closed
coverage.

Related: #2329
Drop the three added stateless tests and their references. Runtime refusal
and log-safety checks overlap retained unit and integration coverage, while
masking uses existing behavior. The remaining cases restate straightforward
settings-validation branches rather than cover distinct regressions.

Related: #2329
Reduce the token-forwarding unit suite to five cases covering cache
invalidation, failed preparation, and in-flight credential/config races.
Remove unused forwarding helpers and simplify shared request recording.

Related: #2329
Shorten documentation and comments, remove redundant code, and replace
unnecessary integration setup with direct forwarding checks.

Pass the query token to `updateMetadata` during Iceberg compaction.

Validation: full unit-test build; 19 affected gtests and all 7 remaining
integration cases passed.

Related: #2329
Simplify request serialization, settings validation, and uncached token
exchange. Remove unused state, instrumentation, fixture settings, and the
STS rejection gtest already covered by integration testing.

Trim repeated documentation and restore unrelated client OAuth encoding
to the release-branch implementation.

Validation: rebuilt ClickHouse and unit tests; affected gtests and all
seven integration cases passed. After removing the redundant gtest, both
remaining STS mock tests and both Glue integration tests passed.

Related: #2329

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

antalya-26.6 port-antalya PRs to be ported to all new Antalya releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants