Repository navigation
Do not let a session switch a shared object storage client to server credentials - #131104
Conversation
…credentials The client of an `S3` or `AzureBlobStorage` table is shared by all sessions, so an opt-in session upgrading it could hand server credentials to a concurrent restricted query that already passed its check. Sessions may now only make the client stricter; only a forced rebuild follows the given context. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ient A direct `SELECT` from an `S3Queue`, and `ALTER`/`OPTIMIZE`/mutations of S3 tables, use the client without refreshing it for the session. A restricted session is now refused there if the client was built with the opt-in and the definition needs the server's credentials, as was already done for Azure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuilding such a client under the restricted context is not a sound check: its stored settings may keep server-derived material, such as a `role_arn` or headers, which only the parsing of a restricted query drops. It could also race with an opt-in rebuild. Now a session never changes the restriction mode of a shared client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A restricted query drops the server's `role_arn`, headers and encryption keys from its S3 settings, but every later query merged the `<s3>` and endpoint auth settings back and rebuilt the client with them. A restricted client now keeps the auth settings it was created with. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Instead of freezing the auth settings of a restricted client, merge the config as before and then restore the fields that the parsing of a restricted query drops (`role_arn`, GCP OAuth, headers, encryption keys) from its stored settings. Static keys rotated in the config still reach existing tables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The parsing of a restricted query filters the config's auth settings with conditional rules, e.g. it drops the config's static keys when the query supplies a `role_arn` without its own keys. Restoring a fixed list of fields after the merge misses such rules, so a restricted client keeps the auth settings it was created with. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sessions with different values of `s3_allow_server_credentials_in_user_queries` do not share a table's access: the table keeps the mode it was created with, and only attaching it again changes it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [c819dc8] Summary: ✅
AI ReviewSummaryReviewed PR #131104 at Missing context / blind spots
Final Verdict✅ Approve. No new inline findings; focused runtime validation remains with CI. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units35 translation units recompiled, 371 s compile time in total, 35 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.08 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
…anonymous A table created with the opt-in now serves no restricted session, so create it restricted. Add a test that an opted-in read does not give the server's identity back to an Azure table loaded anonymously after a restart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@Algunenano — title/description suggestions: Description (currently
Ignore if intentional. |
Related: #120343
Related: #106855
The S3 or Azure client of a table is shared by all sessions that access it. Before, each query rebuilt it for its own session, so a session with
s3_allow_server_credentials_in_user_queriesenabled could switch it to the server's credentials while a restricted query that had already passed its check was still reading with it. Now a table keeps the restriction mode it was created with (or the one of the startup context), and only a forced rebuild by the server changes it.Also:
SELECTfrom anS3Queue, andALTER,OPTIMIZEand mutations of S3 tables, now check the restriction for S3 too, as was already done for Azure.NOSIGN: its settings may hold a serverrole_arn, headers or encryption keys that only the parsing of a restricted query drops.<s3>and endpoint config on each query, which brought back therole_arn, headers and encryption keys dropped when it was created.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Previously, each session accessing a persistent
S3,S3Queue,AzureBlobStorage, orAzureQueuetable could rebuild its shared client using that session'ss3_allow_server_credentials_in_user_queriesvalue. The table now keeps the credential-restriction mode used to build its client. A session where the setting is disabled cannot use anS3orS3Queuetable created with it enabled, even with explicit credentials orNOSIGN; an Azure table is rejected only when its cached client uses the server's identity. Enabling the setting no longer restores server credentials to a table loaded anonymously after restart, and anS3table created with the setting disabled no longer picks up authentication changes from<s3>or endpoint configuration on each query.DETACHandATTACHthe table in a session with the intended setting after restart or credential rotation to rebuild its client.Workflow [PR]
Sync PR [sync-upstream/pr/131104]
Version info
26.11.1.2459-master(included in26.11and later)