Skip to content

Restrict server-managed S3 credentials in user queries (chokepoint, alternative to #104889) - #106855

Merged
Algunenano merged 109 commits into
masterfrom
s3-restrict-server-credentials
Jul 7, 2026
Merged

Algunenano merged 109 commits into
masterfrom
s3-restrict-server-credentials

Conversation

@Algunenano

@Algunenano Algunenano commented Jun 9, 2026 •

Copy link
Copy Markdown
Member

Alternative to #104889. Refines the approach first opened as #106794.

Restricts S3 access that originates from user SQL so it cannot make the server authenticate to S3 with the server's own cloud identity. By default the s3/s3Cluster table functions, the S3/S3Queue engines, S3 named collections, dynamic disk(type=s3, ...) definitions, BACKUP/RESTORE TO S3, DataLake table-data reads, and DataLakeCatalog databases (Glue, BigLake) may no longer resolve server-managed credentials: environment variables, instance metadata (IMDS), IRSA, ECS, instance profile, SSO, AWS config/credentials files, role_arn-based STS assume-role, or the GCP OAuth metadata service.

A request that asks for one of those server-managed sources (for example use_environment_credentials = 1, a role_arn, or http_client = gcp_oauth) without supplying usable explicit credentials is rejected with ACCESS_DENIED. A request that asks for none of them is sent unsigned (anonymous), the same as if NOSIGN had been given. Credentials the operator supplies explicitly are unaffected: keys passed in the query, static keys in a named collection (created via SQL or defined in config), and keys in the server <s3> config.

use_environment_credentials and how to change it

Whether a credential-less request counts as "asking for environment credentials" is decided by use_environment_credentials:

  • Named collections now default it to 0 (it was 1), so a collection that only specifies a URL reads anonymously instead of authenticating with the server's identity. This is one of the fixes the issue suggested. A collection can opt back in with use_environment_credentials = 1.
  • The s3/s3Cluster table functions and S3/S3Queue engines use the built-in default (1) unless the server <s3> config overrides it. To make their credential-less reads anonymous by default, set it globally:
    <s3>
        <use_environment_credentials>0</use_environment_credentials>
    </s3>
    (ClickHouse Cloud already ships this.) Without it, a credential-less s3('public-url') is refused and must use NOSIGN.
  • Disks are unaffected and keep using environment credentials by default (the global built-in default is unchanged), so existing S3 disks keep loading.

Gated by a new session setting s3_allow_server_credentials_in_user_queries (default off; no effect in clickhouse-local). A trusted administrative client enables it in its session or settings profile; it can be pinned for untrusted users with a readonly constraint and an explicit 0 value. CredentialsConfiguration::forbid_implicit_credentials defaults to true, so a newly added S3 entry point is fail-closed (denied server-managed credentials) unless it explicitly opts out.

Loading existing tables on startup

Persistent S3/S3Queue tables, dynamic S3 disks, and DataLakeCatalog databases are revalidated when reloaded from stored metadata (server startup or RESTORE). So that a single such object cannot abort startup, a definition that now resolves restricted server-managed credentials is loaded with an anonymous client instead: the server starts and the object stays in place but is inaccessible until its credentials resolve to a permitted source again. It never silently regains the server identity. This is controlled by a new server setting s3_load_table_anonymously_if_credentials_restricted (default enabled); disabling it makes such a load abort startup instead.

A table created only under a session/profile s3_allow_server_credentials_in_user_queries = 1 override can therefore become inaccessible after restart unless it has explicit credentials or the setting is enabled server-wide.

Server-internal object-storage tables that the server itself creates in the system database (named _<log>_s3 / _s3queue) are exempt: they always take the anonymous-load fallback regardless of the server setting and are re-credentialed in place afterwards, so they never abort startup even in the hard-fail mode.

Style differences from the other two PRs

  • Versus Restrict user-controllable S3 credential resolution #104889: a single, central credential-resolution chokepoint (getCredentialsProvider) plus one session-setting kill switch, fail-closed by default, instead of a per-field separation of user vs. server settings threaded through the configuration, auth-settings, and backup code. It intentionally covers less (no access_header/SSE stripping, no ARN redaction, no URI-aware endpoint matching), trading breadth for a small, contained change.
  • Versus Restrict server-managed S3 credentials in user queries (alternative to #104889) #106794 (the earlier iteration of this same chokepoint approach): the restriction now refuses only requests that explicitly ask for a server-managed mechanism and otherwise falls back to anonymous; named collections default use_environment_credentials to 0; and persistent S3/S3Queue tables loaded from existing metadata are no longer re-checked so they survive a restart.

Backward-incompatible default

A credential-less user query that previously resolved the server's ambient credentials now either goes anonymous (named collections, or any path where the <s3> config sets use_environment_credentials = 0) or is refused with ACCESS_DENIED (where use_environment_credentials is still 1) unless it uses NOSIGN or supplies explicit credentials. The old behaviour can be restored for a request with use_environment_credentials = 1 (and s3_allow_server_credentials_in_user_queries enabled if the restriction is on). This should be deployed and back-ported carefully (Cloud first).

Related: #104889
Related: #106794
Closes: https://github.com/ClickHouse/clickhouse-private/issues/54202

Changelog category (leave one):

  • Backward Incompatible Change

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

S3 access originating from user SQL no longer resolves the server's own cloud credentials (environment, IMDS/IRSA, instance profile, AWS config files, role_arn-based STS, GCP OAuth metadata) by default; such a request must use explicit credentials or NOSIGN. Named collections now default use_environment_credentials to 0. The previous behaviour can be restored per request with use_environment_credentials = 1 (or globally via the <s3> config) together with the new setting s3_allow_server_credentials_in_user_queries (disabled by default). Explicitly supplied and operator-provisioned config credentials are unaffected. On server startup or RESTORE, a persistent S3/S3Queue table, dynamic S3 disk, or DataLakeCatalog whose definition resolves such credentials is loaded anonymously (inaccessible until re-credentialed) instead of aborting startup, controlled by the new server setting s3_load_table_anonymously_if_credentials_restricted (enabled by default).

Version info

  • Merged into: 26.7.1.570 (included in 26.7 and later)

Algunenano and others added 4 commits June 9, 2026 14:40
Add a session setting `s3_allow_server_credentials_in_user_queries` (default off in
clickhouse-server, no effect in clickhouse-local). When off, S3 access driven by user
SQL cannot resolve the server's own ambient credentials (environment, IMDS, IRSA,
`role_arn` STS, AWS config files, or the GCP OAuth metadata service) at the single
credential-resolution chokepoint; a request with no explicit keys and no NOSIGN is
refused with ACCESS_DENIED. Covers the `s3`/`s3Cluster` functions, the `S3`/`S3Queue`
engines, named collections, dynamic S3 disks, BACKUP/RESTORE TO S3, DataLake reads,
and Glue/BigLake catalogs. A constraint can pin it for untrusted users. Operator-
provisioned static credentials in config are intentionally out of scope.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ntial requests

Refine the restriction so it refuses a user-query S3 request only when it
explicitly asks for a server-managed credential mechanism (`use_environment_credentials = 1`,
a `role_arn`, or `http_client = gcp_oauth`) without usable explicit keys. A request that
asks for none of them is sent unsigned (anonymous) instead of being rejected, so anonymous
access to public buckets keeps working without an explicit `NOSIGN`. This is safe because the
provider chain already returns before adding any environment/IMDS/instance-profile/AWS
config-file provider under the restriction, so the server's own credentials are never resolved
regardless. Drop the `04325` no-credentials case that asserted the old reject-everything behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… metadata

A persistent `S3`/`S3Queue` table whose S3 credentials are server-managed (resolved
when the table was created) would fail to load after a server restart, because the
table load re-creates the S3 client and the restriction was re-applied in the load
context. Skip the restriction for `FORCE_ATTACH`/`FORCE_RESTORE` (server startup and
RESTORE), mirroring the dynamic-disk `isLoadingFromExistingMetadata` skip: the
credentials were already validated at CREATE time. A user-issued `ATTACH` still uses
`LoadingStrictnessLevel::ATTACH` and is re-validated, so it cannot bypass the check.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
These tests exercise S3 access that uses server-managed credentials (environment, a
`from_env` value, or no credentials at all with the default `use_environment_credentials`),
which user queries can no longer use by default. Enable
`s3_allow_server_credentials_in_user_queries` on the relevant instances/profiles, the
same way the earlier batch of tests was adapted: test_storage_s3 (restricted_dummy,
s3_max_redirects), test_s3_cluster, test_allowed_url_from_config, test_mask_sensitive_info,
test_restore_external_engines, and test_disk_configuration (including the privileged
`from_env` disk profile).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bbd49b1]

Summary: ❌

job_name test_name status info comment
Stress test (amd_msan) FAIL
Logical error: Not-ready Set is passed as the second argument for function 'A (STID: 0250-41a5) FAIL cidb, issue ISSUE EXISTS

AI Review

Summary

This PR hardens S3-related user SQL by blocking server-managed credentials across table functions, engines, backups, dynamic disks, and DataLakeCatalog. The main restriction plumbing is much tighter now, but three real gaps remain: DataLakeCatalog freezes the opt-in at create time and reuses that trusted catalog for later restricted sessions, the new nested Backup(..., S3(...)) secret masker still leaks positional session_tokens, and the system-log S3 bootstrap path still does not have the working recredential flow the new comments describe.

Findings

❌ Blockers

  • [src/Databases/DataLake/DatabaseDataLake.cpp:1265-1268] Capturing s3_allow_server_credentials_in_user_queries at CREATE DATABASE time makes Glue/BigLake catalogs permanently trusted for later sessions. The constructor eagerly initializes catalog_impl, and getCatalog() then reuses that cached client for every later query, so a privileged CREATE DATABASE ... SETTINGS s3_allow_server_credentials_in_user_queries = 1 lets later restricted users enumerate tables or fetch catalog metadata through the server's ambient AWS/GCP identity. Suggested fix: key the cached catalog by the effective restriction mode, or rebuild/validate it under the current query context the way DatabaseS3 / S3ObjectStorage now do.

  • [src/Parsers/FunctionSecretArgumentsFinder.h:911-915] [dismissed by author -- https://github.com/Restrict server-managed S3 credentials in user queries (chokepoint, alternative to #104889) #106855#discussion_r3468018838] The new nested Backup('', S3(...)) masker still only hides positional argument 2, but StorageS3Configuration::fromAST accepts session_token as positional argument 3 for S3(url, access_key_id, secret_access_key, session_token, ...). That leaves the temporary token visible in formatted query text and query-log output for the new nested-backup path. Suggested fix: hide positional argument 3 in the explicit-key form as well, or drive the masking from the same signature parsing that resolves the S3 arguments.

⚠️ Majors

  • [src/Storages/ObjectStorage/registerStorageObjectStorage.cpp:95-101] The new _s3 / _s3queue exemption still does not give the shared system-log pipeline a working bootstrap. force_anonymous_load_fallback only takes effect on metadata reload (getClient still gates it behind is_loading_from_existing_metadata), so the first SystemLog::prepareTable() CREATE still hits ACCESS_DENIED; after restart, _s3queue has rebuildObjectStorageClient, but nothing calls it, and the plain _s3 sink has no recredential path at all. Suggested fix: either set s3_allow_server_credentials_in_user_queries = 1 on these server-internal create/insert contexts, or add an actual post-startup recredential flow for both _s3 and _s3queue.
Final Verdict

Not ready. The DataLakeCatalog create-time capture is a security bypass, and the remaining secret-masking and system-log bootstrap gaps should be fixed before merge.

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Jun 9, 2026
Comment thread src/IO/S3/Credentials.cpp Resolved
Comment thread src/IO/S3/Credentials.cpp Resolved
…sses role_arn

Address review of the S3 user-credential restriction:

- Named collections default `use_environment_credentials` to 0 (was 1), so a
  collection that only specifies a URL reads anonymously instead of authenticating
  with the server's own cloud identity. A collection can opt back in with
  `use_environment_credentials = 1`; the `s3` table function / disks keep the
  built-in default, and `<s3><use_environment_credentials>0</...>` makes table-function
  reads anonymous globally (as ClickHouse Cloud already ships).
- `getCredentialsProvider` skips the `role_arn` STS assume-role wrapper when
  `no_sign_request` is set, so NOSIGN truly bypasses credential resolution instead of
  running STS on top of the anonymous provider.

The setting description is updated accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread src/Backups/registerBackupEngineS3.cpp Resolved
…ions

A `BACKUP`/`RESTORE TO S3(named_collection)` inherited `use_environment_credentials`
from the global `<s3>` config (default 1), so a URL-only backup collection authenticated
with the server's own identity and was refused under the restriction, unlike the `s3`
table function whose named-collection default is now 0. Carry the collection's
`use_environment_credentials` (defaulting to 0 for named collections) through
BackupReaderS3/BackupWriterS3; the explicit url/key form leaves it unset and keeps the
server `<s3>` config default.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…eries override

StorageObjectStorageQueue is constructed with the global context (args.getContext()),
so a `CREATE ... ENGINE = S3Queue(...) SETTINGS s3_allow_server_credentials_in_user_queries = 1`
override did not reach the S3 client and the queue was rejected, unlike the `S3` engine.
Apply the creating query's session/profile settings onto the storage context, mirroring
registerStorageObjectStorage. Add a stateless regression.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Algunenano
Algunenano marked this pull request as ready for review June 10, 2026 08:24
Algunenano and others added 2 commits June 10, 2026 08:49
…ic disks

Two consistency fixes for the S3 user-credential restriction so the forms the
credential chokepoint already accepts are also reachable from user SQL:

- Named collections now accept and propagate the explicit Google Application
  Default Credentials triple (`google_adc_client_id`, `google_adc_client_secret`,
  `google_adc_refresh_token`). With `http_client = gcp_oauth` this is a
  user-supplied credential, so the restriction allows it instead of minting a
  token from the server's GCP metadata service.

- A dynamic S3 disk with an explicit `use_environment_credentials = 0` and no
  `role_arn` is now allowed: it asks for no server-managed credential and goes
  unsigned, matching the anonymous behavior of any other user query. Bare
  no-credential disks (default `use_environment_credentials = 1`), `role_arn`
  without explicit keys, and `gcp_oauth` without an explicit ADC triple are
  still refused.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread src/IO/S3/Credentials.cpp Resolved
Comment thread src/Backups/BackupIO_S3.cpp Resolved
Algunenano and others added 3 commits June 10, 2026 15:49
Two more consistency fixes for the explicit Google ADC form under the S3
user-credential restriction:

- `getCredentialsProvider` built an anonymous provider for `http_client =
  gcp_oauth` (the real authentication is a bearer token at the HTTP layer), but
  the STS assume-role wrapper still ran for any non-empty `role_arn`. A stale
  `role_arn` alongside an explicit ADC triple would attempt `AssumeRole` on top
  of the anonymous provider instead of using the ADC directly. Skip the wrapper
  for `gcp_oauth`, the same way it is skipped for `no_sign_request`.

- `S3BackupClientCreator` copied `http_client`/`service_account`/
  `metadata_service`/`request_token_path` into the client configuration but not
  the Google ADC triple, so `BACKUP`/`RESTORE TO S3` with `gcp_oauth` plus an
  explicit ADC in the server `<s3>` config reached the restriction as `gcp_oauth`
  without ADC and was rejected. Propagate the three ADC auth settings, matching
  the object-storage client builder.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread src/Databases/DataLake/GlueCatalog.cpp Resolved
Comment thread src/Backups/registerBackupEngineS3.cpp Resolved
Algunenano and others added 3 commits June 10, 2026 17:30
… a flag

The previous S3Queue credential-override fix passed a freshly created context
copy to the storage as its own context. `StorageObjectStorageQueue` holds that
context weakly through `WithContext`, and the background streaming `threadFunc`
calls `getContext` on it, so once the transient copy was destroyed the task
threw `Context has expired` (a logical error) on every poll. Because the change
was in `createQueueStorage`, it affected every S3Queue and AzureQueue table, so
the error surfaced in unrelated tests whose servers also ran queue background
tasks.

Keep passing the persistent global context (`args.getContext()`) to the storage,
and pass the effective `s3_allow_server_credentials_in_user_queries` value from
the CREATE query as a separate flag. The constructor applies it to a transient
context used only to build the object storage client (which copies the context
into its own credential refresher), so the per-session override still reaches
the S3 client without leaving the storage holding an expiring context.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106855&sha=dec44ba4d6a84822290bad9abf0bf73b6f4f009c&name_0=PR

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ections

Two follow-ups to the explicit Google ADC support in S3 named collections:

- The query secret masker only recognized `secret_access_key` for `s3`/`S3`
  named-collection arguments, so `google_adc_client_secret` and
  `google_adc_refresh_token` supplied as overrides stayed visible in formatted
  queries and the query log. The S3 named-collection masking now hides the span
  covering every secret-bearing key present (`secret_access_key` and the two ADC
  secrets); a non-secret named argument in between is hidden too, which is safe.
  This applies to the `s3`/`S3` table function, the `S3` table and database
  engines, and `BACKUP`/`RESTORE TO S3(named_collection)`.

- The backup named-collection parser carried only the key pair, `role_arn`,
  `role_session_name`, `no_sign_request`, and `use_environment_credentials`, so a
  collection with `http_client = gcp_oauth` plus an explicit ADC triple dropped
  those before `BackupReaderS3`/`BackupWriterS3` built `S3Settings` and the
  allowed explicit-ADC case could not work for `BACKUP`/`RESTORE TO S3`.
  Propagate `http_client` and the ADC triple from the collection as well.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…-credentials

# Conflicts:
#	src/Backups/BackupIO_S3.cpp
#	src/Backups/BackupIO_S3.h
#	src/Backups/registerBackupEngineS3.cpp
#	src/Coordination/KeeperSnapshotManagerS3.cpp
#	src/IO/S3/tests/gtest_aws_s3_client.cpp
@clickgapai

Copy link
Copy Markdown
Contributor

Hi @Algunenano — while reviewing this PR I found the following:

Happy to discuss — close anything that's wrong or already addressed.

pull Bot pushed a commit to AnotherGenZ/ClickHouse that referenced this pull request Jul 12, 2026
The load_data() step reads public clickhouse-datasets S3 files via the
s3() table function. After ClickHouse#106855 the server rejects such reads with
Code 497 (ACCESS_DENIED) because they fall back to server-managed
credentials, which are now disallowed in user queries by default. The
datasets are public, so read them with NOSIGN.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
asya-ch added a commit that referenced this pull request Aug 3, 2026
…for internal create

Resolve conflicts against 26.6:

- Keep `getBearerToken`; the `OneLakeCatalog::getAuthHeaders` user-agent
  override (#108117) is not in 26.6 and is unrelated to this fix.
- Drop `allow_server_credentials_in_user_queries` and
  `is_loading_from_existing_metadata` from the `DatabaseDataLake`
  constructor call; both come from #106855, which is not backported to
  26.6 and whose credential restriction is deliberately left out.
- Thread the existing `internal` flag from `InterpreterCreateQuery`
  through `DatabaseFactory` (the plumbing from 274f167, without the
  S3 credential restriction). Required by `lazy_init` for internal
  creates; both 26.6 call sites, `loadMetadata` and `RestorerFromBackup`,
  already set the flag.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The `arm_tidy` build flagged two issues in `Credentials.cpp`: a duplicate
`#include <IO/S3/Client.h>` (already included inside `#if USE_AWS_S3`) and a
manual `max_retries` clamp that should use `std::min`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106855&sha=66039ce735fe8dda61a386b8b70ef6972243939a&name_0=PR&name_1=Build%20%28arm_tidy%29
PR: ClickHouse#106855

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
A backup named collection with an explicit temporary (STS) key triplet dropped
the `session_token`, so the request was signed without it. Thread the collection's
`session_token` into the named-collection auth override and on into the S3 client
creation, matching the `s3` table function and `S3` engine.

PR: ClickHouse#106855

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The restriction was skipped when loading an object-storage table or S3 queue from
existing metadata (server startup / RESTORE), on the assumption the credentials
were validated at CREATE time. But the stored definition can be re-bound to a
mutable source afterwards: a named collection created URL-only can later be set to
`use_environment_credentials = 1` (or a server `<s3>` `role_arn` added), and on the
next restart the skip would let the table silently regain the server identity, even
though a user `CREATE`/`ATTACH` of the same definition would be refused. A user with
`NAMED COLLECTION ADMIN` but no permission for the setting could thus escalate.

Re-apply the restriction on load. A table that now resolves to server-managed
credentials simply fails to build its client and becomes inaccessible after a
restart instead of escalating; the server itself still starts.

PR: ClickHouse#106855
Closes review threads:
ClickHouse#106855 (comment)
ClickHouse#106855 (comment)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
For persistent `S3`/`S3Queue` tables, enabling `s3_allow_server_credentials_in_user_queries`
only per session or profile does not survive a restart: the table is revalidated with the
startup context on reload, so one that relied on server-managed credentials becomes
inaccessible after a restart. Document this and point operators to explicit credentials (or a
server-wide setting) for durable access.

PR: ClickHouse#106855
Closes review thread: ClickHouse#106855 (comment)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…stricted

Re-applying the user-query S3 credential restriction when loading a persistent
table from existing metadata (server startup or RESTORE) makes the server fail to
start if the table resolves server-managed credentials -- including a table
created before the restriction existed, or one whose named collection was later
re-bound to `use_environment_credentials = 1`. Such a table cannot be migrated to
explicit credentials before the upgrade, so a hard failure would brick startup.

Add a server setting `s3_load_table_anonymously_if_credentials_restricted`
(default true): when loading such a table, build an anonymous S3 client instead of
throwing. The server starts, the table is inaccessible (its requests to a private
bucket are denied) and never silently regains the server identity. Set it to 0 to
fail loading instead. User `CREATE`/queries are unchanged -- still rejected with
`ACCESS_DENIED`.

PR: ClickHouse#106855

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
test_file_pruning_with_hive_style_partitioning[_2] restarts the old-version node
onto the current binary and re-queries a bare-URL S3 table. A bare URL resolves
the server's environment credentials, which are now restricted for user queries,
and the old version cannot enable the override, so the table would be inaccessible
after the restart. Give those tables explicit keys instead.

PR: ClickHouse#106855

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
A Glue/BigLake `DataLakeCatalog` database loaded from existing metadata (server
startup or RESTORE) was treated as allowed to use server-managed credentials --
the restriction was skipped on load. So a catalog created before this PR, or one
whose server ambient identity changes later, would let untrusted users reach the
server's IMDS/instance-profile/`role_arn`/GCP-metadata credentials after a
restart, even at the new default. This is the same restart surface the PR closes
for persistent `S3`/`S3Queue` tables.

Re-apply the restriction on load. If the catalog then resolves restricted
server-managed credentials and fails to build, leave it unavailable (the database
is inaccessible and `getCatalog` reports a clear error; the server still starts)
rather than escalating or aborting startup -- governed by the existing
`s3_load_table_anonymously_if_credentials_restricted` server setting, mirroring
the table behavior. A catalog given explicit credentials is unaffected and durable
across restart.

PR: ClickHouse#106855
Closes review thread: ClickHouse#106855 (comment)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…er-credentials

Restrict server-managed S3 credentials in user queries (chokepoint, alternative to ClickHouse#104889)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The load_data() step reads public clickhouse-datasets S3 files via the
s3() table function. After ClickHouse#106855 the server rejects such reads with
Code 497 (ACCESS_DENIED) because they fall back to server-managed
credentials, which are now disallowed in user queries by default. The
datasets are public, so read them with NOSIGN.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ClickHouse__ClickHouse that referenced this pull request Nov 13, 2026
…ed as paths, two readings of one input

Blind reviews of the pull requests that introduced nine bugs fixed later (ported in ClickHouse#131294-ClickHouse#131302) showed these gaps:
- Data the server wrote itself and reads back (parts, patch parts, packed-file indexes, `ssd_cache` files) was
  treated as trusted, so out-of-bounds reads on it were dismissed or rated as Nits (ClickHouse#126553, ClickHouse#116007, ClickHouse#86095).
- No prompt for overflow of sizes computed from user-controlled counts (`ColumnString::replicate`, ClickHouse#61075).
- No prompt for names read from data that become paths (packed archive index, ClickHouse#93414).
- A security check that reads its input differently from the consumer (first vs last repeated key, Boolean
  spellings), which the real review of ClickHouse#106855 missed.
Also ask for a separate pass over parsers and security decisions in large pull requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes 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.

5 participants