Repository navigation
[fix](fe) Preserve session roles in metadata authorization - #70453
Open
CalvinKirs wants to merge 4 commits into
Open
CalvinKirs wants to merge 4 commits into
CalvinKirs wants to merge 4 commits into
Conversation
### Background Authentication integrations can grant roles for a login session without creating persistent user-role bindings. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Bugfix Problem Summary: A user authorized by session role mapping can query a table but see no rows in information_schema.schemata, tables, or columns. Carry session roles through the shared RPC identity and reuse the existing role resolver for metadata authorization. ### Details - **Change map:** Production +178/-42 lines in 19 files; tests +370/-2 lines in 3 files. Most sending sites change one identity snapshot call. - **Frequency:** Metadata queries whose privileges depend on authentication-granted roles. - **Root cause:** Schema callbacks carry the account but lose the login session roles; the authorization plugin adapter also reconstructs an account-only identity. - **Why existing tests missed it:** Session role tests checked local authorization with a connection on the thread, without serializing the identity or checking metadata callbacks. - **Fix:** Snapshot authentication roles in the shared identity sender, preserve them across the authorization adapter, and merge them with persistent and LDAP roles in the existing resolver. Session roles remain transient and are not persisted as grants. - **Other paths and branches:** Update schema scans, metadata TVFs, Flight metadata requests, process-list requests, and FE forwarding on master. The optional field uses the same free id across maintained release branches. Both FE and BE must be upgraded to preserve it; older BE binaries retain the existing metadata behavior. ### Testing - FE unit tests: 152 passed across metadata callbacks, session role transport, authentication integration / role mapping, built-in and plugin authorization, connection handling, and the frozen authorization SPI contract. - FE Checkstyle: passed. - No native BE build or live OIDC provider test. ### Release note Fix missing information_schema metadata for users whose permissions come from authentication role mapping after upgrading FE and BE. ### Check List (For Author) - Test: Unit Test - Behavior changed: Yes (metadata authorization retains authentication-granted roles) - Does this need documentation: No - Pre-submission status: Partially verified: native BE and a live OIDC provider were not tested ### AI Disclosure - Tool: Codex - Generated: Code, tests, and commit message - Human review: Pending maintainer review
### Background Metadata authorization must retain authentication-granted roles for the request without turning them into persistent account memberships. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Bugfix Problem Summary: Forwarded session identities can retain temporary roles as durable job creators, while captured data-policy contexts can discard those roles. Separate received session roles from account identity, preserve the role scope in policy snapshots, and keep synthetic LDAP privilege objects out of plugin role names. ### Details - **Frequency:** Forwarded mapped-role sessions, captured policy evaluation, and legacy LDAP users with role-based plugins. - **Root cause:** Shared account identities were used as session carriers; frozen policy contexts copied only IP/query ID; plugin role lookup exposed LDAP's synthetic information_schema role. - **Why existing tests missed it:** They did not cross durable creator serialization, frozen role-sensitive policy contexts, or synthetic/real same-name role boundaries. - **Fix:** Use a common RPC session receiver, compare role scopes in captured policies, and share managed local/mapped role resolution while retaining legacy LDAP privilege handling for built-in checks. - **Other paths and branches:** Keep legacy forwarded requests role-free and preserve native-session and named-role behavior on master. ### Testing - Official run-fe-ut.sh: 182 tests passed in 16 classes, including metadata, authentication, plugin contracts, policy snapshots, job-owner serialization and partition-policy safety. - FE Checkstyle passed. - No native BE build or live OIDC provider test. ### Release note Preserve session role scope for forwarded metadata and policy checks without retaining temporary authority in account identities or exposing internal LDAP privilege roles to plugins. ### Check List (For Author) - Test: Unit Test - Behavior changed: Yes (correct session-role scope across metadata and policy boundaries) - Does this need documentation: No - Pre-submission status: Partially verified: native BE and a live OIDC provider were not tested ### AI Disclosure - Tool: Codex - Generated: Code, tests, and commit message - Human review: Pending maintainer review
CalvinKirs
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
November 11, 2026 01:44
Contributor
|
run cloudut |
Member
Author
|
run buildall |
### Background Flight SQL metadata requests use a shared session identity snapshot that carries authentication-plugin roles. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Test Problem Summary: All 27 FlightSqlSchemaHelperTableTypesTest cases fail because their mocked ConnectContext only stubs the old account getter, leaving the new RPC identity snapshot null. Use a real session context and check role transport with and without returned table schemas. ### Details - **Change map:** One test file, +36/-10; no production changes. - **Scenarios:** Existing table-type aliases, filtering and external catalogs, plus session roles with and without table schemas. - **What existing tests miss:** A stale mock cannot exercise the real session identity serializer or preserve roles in metadata requests. - **Fails when broken:** The previous fixture fails all 27 cases with a null identity; added role-bearing cases fail if any database/table/column metadata request loses the role snapshot. ### Testing - Official run-fe-ut.sh: 184 tests passed in 21 Flight SQL, session-role, metadata and authorization SPI classes, including all 29 table-type cases. - FE Checkstyle passed. - CI failure evidence checked against the previous commit. ### Release note None ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: Codex - Generated: Test change and commit message - Human review: Pending maintainer review
Member
Author
|
run buildall |
Member
Author
|
run buildall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Authentication plugins can supply session roles without creating persistent user-role grants.
What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Bugfix
Problem Summary: Users whose permissions come from other authentication plugins can query tables, but
information_schema.schemata,tablesandcolumnsomit accessible objects because metadata requests lose their session roles.For example, grant
r1SELECT oninternal.db1.t1, then log in through an authentication plugin that suppliesr1as a session role without a persistent user-role grant:Details
Testing
run-fe-ut.sh: 182 tests passed in 16 classes; FE Checkstyle passed.Release note
Fix missing system metadata for users authorized through authentication-plugin session roles after upgrading FE and BE.
Check List (For Author)
AI Disclosure