Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7437089
[feature](auth) SU: session-narrowed identity switch
raghav-reglobe Sep 3, 2026
2e2d50c
[fix](auth) SU: carry the session's narrowed role set across every FE…
raghav-reglobe Sep 8, 2026
1402f55
[feature](audit) Record the account that authenticated the connection…
raghav-reglobe Sep 8, 2026
6ac650e
[feature](auth) SU: gate the switch on a native PROXY_PRIV; the ceili…
raghav-reglobe Sep 8, 2026
b3d0767
[test](auth) SU: regression suite for the session-narrowed identity s…
raghav-reglobe Sep 8, 2026
6d5d828
[test](auth) SU tests: JUnit 5 assertions, and two test fixes
raghav-reglobe Sep 8, 2026
44e4992
[fix](auth) SU: register PROXY_PRIV with the authorization plugin SPI
raghav-reglobe Sep 15, 2026
75d0238
[test](auth) SU: give the forward-request probe a MySQL capability
raghav-reglobe Sep 15, 2026
39e05e6
[fix](fe) Preserve SU narrowing when changing users fails
morningman Oct 30, 2026
4f1b875
[fix](auth) SU: make "session is narrowed" an explicit ConnectContext…
raghav-reglobe Sep 28, 2026
1be3992
[test](audit) Expect authenticated_user in the audit_log schema listing
raghav-reglobe Oct 31, 2026
a90d4eb
[fix](auth) SU: run every BE->FE metadata RPC handler under the carri…
raghav-reglobe Oct 31, 2026
c5e6524
[fix](audit) SU: name the authenticating account on forwarded stateme…
raghav-reglobe Oct 31, 2026
77a3f4f
[fix](auth) SU: placement follows the person for compute groups too, …
raghav-reglobe Oct 31, 2026
3ba24ea
[fix](auth) SU: information_schema scans that leave this FE fail clos…
raghav-reglobe Oct 31, 2026
f49d3bb
[fix](auth) SU: PROXY_PRIV never climbs the administrative ladder; no…
raghav-reglobe Nov 2, 2026
fe7b588
[fix](auth) SU: journal the heartbeat build so followers can forward,…
raghav-reglobe Nov 2, 2026
25a095d
[fix](auth) SU: the narrowed set is a live intersection with the targ…
raghav-reglobe Nov 2, 2026
c542fa2
[fix](auth) SU: the authorization-SPI role bridge resolves through th…
raghav-reglobe Nov 2, 2026
748c4c9
[fix](auth) SU: placement widening answers USAGE only, on both legs; …
raghav-reglobe Nov 2, 2026
74c0d88
[fix](auth) SU: refuse EXPORT and CREATE JOB in a narrowed session; t…
raghav-reglobe Nov 2, 2026
63ba606
[fix](auth) SU: SHOW PROCESSLIST names the role subset on its FE fan-…
raghav-reglobe Nov 2, 2026
5af7096
[fix](auth) SU: the target's account state is checked, an LDAP-only t…
raghav-reglobe Nov 3, 2026
9d68b6c
[fix](auth) SU: user() names the authenticating account, the SQL-cach…
raghav-reglobe Nov 3, 2026
814ed4a
[fix](auth) SU: drop the HashSet import Auth no longer uses
raghav-reglobe Nov 3, 2026
e579984
[fix](auth) SU: the routine-load workload-group lookup keeps its iden…
raghav-reglobe Nov 3, 2026
c565d53
[fix](planner) SU: drop the stray copy of the all-FE build gate left …
raghav-reglobe Nov 3, 2026
1923b97
[fix](auth) SU: the compute-group placement widening tests the bit a …
raghav-reglobe Nov 3, 2026
826fd25
[fix](auth) SU: listTableMetadataNameIds carries the RPC narrowing on…
raghav-reglobe Nov 3, 2026
815fb02
[fix](auth) SU: tidy -- the build-gate Javadoc sits on its own method…
raghav-reglobe Nov 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion be/src/exec/operator/meta_scan_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Status MetaScanLocalState::_init_scanners(std::list<ScannerSPtr>* scanners) {
for (auto& scan_range : _scan_ranges) {
std::shared_ptr<MetaScanner> scanner =
MetaScanner::create_shared(state(), this, p._tuple_id, scan_range, p._limit,
custom_profile(), p._user_identity);
custom_profile(), p._user_identity, p._current_roles);
RETURN_IF_ERROR(scanner->init(state(), _conjuncts));
scanners->push_back(scanner);
}
Expand All @@ -55,6 +55,9 @@ MetaScanOperatorX::MetaScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, i
if (tnode.meta_scan_node.__isset.current_user_ident) {
_user_identity = tnode.meta_scan_node.current_user_ident;
}
if (tnode.meta_scan_node.__isset.current_roles) {
_current_roles = tnode.meta_scan_node.current_roles;
}
}

} // namespace doris
3 changes: 3 additions & 0 deletions be/src/exec/operator/meta_scan_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <stdint.h>

#include <set>
#include <string>

#include "common/status.h"
Expand Down Expand Up @@ -61,6 +62,8 @@ class MetaScanOperatorX final : public ScanOperatorX<MetaScanLocalState> {

TupleId _tuple_id;
TUserIdentity _user_identity;
// SU narrowing: the session's active role subset (TMetaScanNode.current_roles). Empty = none.
std::set<std::string> _current_roles;
};

/// Instantiated once in scan_operator.cpp; suppresses per-TU implicit instantiation.
Expand Down
6 changes: 6 additions & 0 deletions be/src/exec/operator/schema_scan_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Status SchemaScanOperatorX::init(const TPlanNode& tnode, RuntimeState* state) {
}
}

// SU narrowing: carry the SU-narrowed role subset from the FE plan to the scanners so the
// BE->FE metadata RPCs narrow name visibility (empty/unset = no narrowing, prior behavior).
if (tnode.schema_scan_node.__isset.current_roles) {
_common_scanner_param->current_roles = tnode.schema_scan_node.current_roles;

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.

[P1] Carry narrowing through SCH_USER as well. This stores TSchemaScanNode.current_roles, but SchemaUserScanner still builds a TShowUserRequest with only the user identity and showUser is not wrapped. If the target has a direct GRANT/ADMIN role omitted from SU, mysql.user can expose the target's full account list and privilege topology. Add a role field to this request and apply/clear it in the handler (or use the common metadata path).

}

if (tnode.schema_scan_node.__isset.ip) {
_common_scanner_param->ip =
state->obj_pool()->add(new std::string(tnode.schema_scan_node.ip));
Expand Down
23 changes: 20 additions & 3 deletions be/src/exec/scan/meta_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <ostream>
#include <string>
#include <unordered_map>
#include <utility>

#include "common/cast_set.h"
#include "common/logging.h"
Expand Down Expand Up @@ -55,13 +56,21 @@ namespace doris {

MetaScanner::MetaScanner(RuntimeState* state, ScanLocalStateBase* local_state, TupleId tuple_id,
const TScanRangeParams& scan_range, int64_t limit, RuntimeProfile* profile,
TUserIdentity user_identity)
TUserIdentity user_identity, std::set<std::string> current_roles)
: Scanner(state, local_state, limit, profile),
_meta_eos(false),
_tuple_id(tuple_id),
_user_identity(user_identity),
_current_roles(std::move(current_roles)),
_scan_range(scan_range.scan_range) {}

void MetaScanner::_set_session_identity(TMetadataTableRequestParams* params) const {
params->__set_current_user_ident(_user_identity);
if (!_current_roles.empty()) {
params->__set_current_roles(_current_roles);
}
}

Status MetaScanner::_open_impl(RuntimeState* state) {
VLOG_CRITICAL << "MetaScanner::open";
RETURN_IF_ERROR(Scanner::_open_impl(state));
Expand Down Expand Up @@ -313,6 +322,7 @@ Status MetaScanner::_build_backends_metadata_request(const TMetaScanRange& meta_
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::BACKENDS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_backends_metadata_params(meta_scan_range.backends_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -332,6 +342,7 @@ Status MetaScanner::_build_frontends_metadata_request(const TMetaScanRange& meta
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::FRONTENDS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_frontends_metadata_params(meta_scan_range.frontends_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -351,6 +362,7 @@ Status MetaScanner::_build_frontends_disks_metadata_request(const TMetaScanRange
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::FRONTENDS_DISKS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_frontends_metadata_params(meta_scan_range.frontends_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -368,7 +380,7 @@ Status MetaScanner::_build_workload_sched_policy_metadata_request(
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::WORKLOAD_SCHED_POLICY);
metadata_table_params.__set_current_user_ident(_user_identity);
_set_session_identity(&metadata_table_params);

request->__set_metada_table_params(metadata_table_params);
return Status::OK();
Expand All @@ -384,7 +396,7 @@ Status MetaScanner::_build_catalogs_metadata_request(const TMetaScanRange& meta_
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::CATALOGS);
metadata_table_params.__set_current_user_ident(_user_identity);
_set_session_identity(&metadata_table_params);

request->__set_metada_table_params(metadata_table_params);
return Status::OK();
Expand All @@ -404,6 +416,7 @@ Status MetaScanner::_build_materialized_views_metadata_request(
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::MATERIALIZED_VIEWS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_materialized_views_metadata_params(
meta_scan_range.materialized_views_params);

Expand All @@ -425,6 +438,7 @@ Status MetaScanner::_build_partitions_metadata_request(const TMetaScanRange& met
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::PARTITIONS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_partitions_metadata_params(meta_scan_range.partitions_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -444,6 +458,7 @@ Status MetaScanner::_build_jobs_metadata_request(const TMetaScanRange& meta_scan
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::JOBS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_jobs_metadata_params(meta_scan_range.jobs_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -463,6 +478,7 @@ Status MetaScanner::_build_tasks_metadata_request(const TMetaScanRange& meta_sca
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::TASKS);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_tasks_metadata_params(meta_scan_range.tasks_params);

request->__set_metada_table_params(metadata_table_params);
Expand All @@ -483,6 +499,7 @@ Status MetaScanner::_build_partition_values_metadata_request(
// create TMetadataTableRequestParams
TMetadataTableRequestParams metadata_table_params;
metadata_table_params.__set_metadata_type(TMetadataType::PARTITION_VALUES);
_set_session_identity(&metadata_table_params);
metadata_table_params.__set_partition_values_metadata_params(
meta_scan_range.partition_values_params);

Expand Down
8 changes: 7 additions & 1 deletion be/src/exec/scan/meta_scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <gen_cpp/Types_types.h>

#include <cstdint>
#include <set>
#include <vector>

#include "common/factory_creator.h"
Expand Down Expand Up @@ -49,7 +50,7 @@ class MetaScanner : public Scanner {
public:
MetaScanner(RuntimeState* state, ScanLocalStateBase* local_state, TupleId tuple_id,
const TScanRangeParams& scan_range, int64_t limit, RuntimeProfile* profile,
TUserIdentity user_identity);
TUserIdentity user_identity, std::set<std::string> current_roles);

Status _open_impl(RuntimeState* state) override;
Status close(RuntimeState* state) override;
Expand Down Expand Up @@ -86,6 +87,11 @@ class MetaScanner : public Scanner {
bool _meta_eos;
TupleId _tuple_id;
TUserIdentity _user_identity;
// SU narrowing: the session's active role subset, forwarded on every metadata request so the
// FE narrows its privilege checks to it. Empty = not narrowed.
std::set<std::string> _current_roles;
// Stamps who is asking (and the narrowing, if any) on a metadata request.
void _set_session_identity(TMetadataTableRequestParams* params) const;
const TupleDescriptor* _tuple_desc = nullptr;
std::vector<TRow> _batch_data;
const TScanRange& _scan_range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Status SchemaAuthenticationIntegrationsScanner::_get_authentication_integrations
schema_table_request_params.columns_name.emplace_back(_s_tbls_columns[i].name);
}
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}
if (_param->common_param->frontend_conjuncts) {
schema_table_request_params.__set_frontend_conjuncts(
*_param->common_param->frontend_conjuncts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ Status SchemaCatalogMetaCacheStatsScanner::_fetch_from_fe(size_t column_count,
schema_table_request_params.columns_name.emplace_back(_s_tbls_columns[i].name);
}
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}

TFetchSchemaTableDataRequest request;
request.__set_schema_table_name(TSchemaTableName::CATALOG_META_CACHE_STATS);
Expand Down
9 changes: 9 additions & 0 deletions be/src/information_schema/schema_columns_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Status SchemaColumnsScanner::start(RuntimeState* state) {
}
if (nullptr != _param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
db_params.__set_user(*(_param->common_param->user));
Expand Down Expand Up @@ -339,6 +342,9 @@ Status SchemaColumnsScanner::_get_new_desc() {

if (nullptr != _param->common_param->current_user_ident) {
desc_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
desc_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
desc_params.__set_user(*(_param->common_param->user));
Expand Down Expand Up @@ -374,6 +380,9 @@ Status SchemaColumnsScanner::_get_new_table() {
}
if (nullptr != _param->common_param->current_user_ident) {
table_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
table_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
table_params.__set_user(*(_param->common_param->user));
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_extensions_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Status SchemaExtensionsScanner::_get_extensions_block_from_fe() {
schema_table_request_params.columns_name.emplace_back(_s_tbls_columns[i].name);
}
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}

TFetchSchemaTableDataRequest request;
request.__set_schema_table_name(TSchemaTableName::EXTENSIONS);
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_files_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ Status SchemaFilesScanner::start(RuntimeState* state) {
}
if (nullptr != _param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
db_params.__set_user(*(_param->common_param->user));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Status SchemaMetadataNameIdsScanner::start(RuntimeState* state) {
}
if (nullptr != _param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
db_params.__set_user(*(_param->common_param->user));
Expand Down Expand Up @@ -105,6 +108,9 @@ Status SchemaMetadataNameIdsScanner::_get_new_table() {
}
if (nullptr != _param->common_param->current_user_ident) {
table_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
table_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
table_params.__set_user(*(_param->common_param->user));
Expand Down
6 changes: 6 additions & 0 deletions be/src/information_schema/schema_per_db_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Status SchemaPerDbScanner::start(RuntimeState* state) {
}
if (_param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
}
// The planner lifts an exact `TABLE_SCHEMA = '...'` out of the query for us. Without
// it every visible database is listed and asked for its rows, and everything but one
Expand Down Expand Up @@ -82,6 +85,9 @@ Status SchemaPerDbScanner::get_onedb_info_from_fe(int64_t db_id) {
schema_table_request_params.columns_name.emplace_back(column.name);
}
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}
schema_table_request_params.__set_catalog(*_param->common_param->catalog);
schema_table_request_params.__set_dbId(db_id);
// Same reason as the database pattern above: an exact `TABLE_NAME = '...'` lets the FE
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_processlist_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Status SchemaProcessListScanner::start(RuntimeState* state) {
request.__set_show_full_sql(true);
request.__set_time_zone(state->timezone());
request.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
request.__set_current_roles(_param->common_param->current_roles);
}

for (const auto& fe_addr : _param->common_param->fe_addr_list) {
TShowProcessListResult tmp_ret;
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_profiling_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Status SchemaProfilingScanner::start(RuntimeState* state) {
}
if (nullptr != _param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
db_params.__set_user(*(_param->common_param->user));
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_role_mappings_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Status SchemaRoleMappingsScanner::_get_role_mappings_block_from_fe() {
schema_table_request_params.columns_name.emplace_back(_s_tbls_columns[i].name);
}
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}
if (_param->common_param->frontend_conjuncts) {
schema_table_request_params.__set_frontend_conjuncts(
*_param->common_param->frontend_conjuncts);
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ struct SchemaScannerCommonParam {
const std::string* catalog = nullptr;
std::set<TNetworkAddress> fe_addr_list;
std::set<std::string> required_columns;
// SU narrowing: the session's active role subset (TSchemaScanNode.current_roles), forwarded
// on the BE->FE metadata RPCs so they narrow name visibility. Empty = not narrowed.
std::set<std::string> current_roles;
};

// scanner parameter from frontend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Status SchemaSchemaPrivilegesScanner::_get_new_table() {
}
if (nullptr != _param->common_param->current_user_ident) {
table_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
table_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
table_params.__set_user(*(_param->common_param->user));
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_schemata_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ Status SchemaSchemataScanner::start(RuntimeState* state) {
}
if (nullptr != _param->common_param->current_user_ident) {
db_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
db_params.__set_current_roles(_param->common_param->current_roles);
}
} else {
if (nullptr != _param->common_param->user) {
db_params.__set_user(*(_param->common_param->user));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Status SchemaSqlBlockRuleStatusScanner::_get_sql_block_rule_status_block_from_fe

TSchemaTableRequestParams schema_table_request_params;
schema_table_request_params.__set_current_user_ident(*_param->common_param->current_user_ident);
if (!_param->common_param->current_roles.empty()) {
schema_table_request_params.__set_current_roles(_param->common_param->current_roles);
}
schema_table_request_params.__set_frontend_conjuncts(*_param->common_param->frontend_conjuncts);

TFetchSchemaTableDataRequest request;
Expand Down
3 changes: 3 additions & 0 deletions be/src/information_schema/schema_table_privileges_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Status SchemaTablePrivilegesScanner::_get_new_table() {
}
if (nullptr != _param->common_param->current_user_ident) {
table_params.__set_current_user_ident(*(_param->common_param->current_user_ident));
if (!_param->common_param->current_roles.empty()) {
table_params.__set_current_roles(_param->common_param->current_roles);

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.

[P1] Install current_roles in every TGetTables metadata handler. These scanners now send the SU role subset here, but listTableMetadataNameIds, listTablePrivilegeStatus, listSchemaPrivilegeStatus, and listUserPrivilegeStatus never call withSessionRoleOverride; their Auth checks therefore run with no ConnectContext and resolve the target's full role union. A narrowed session can regain excluded direct SHOW/SELECT/GRANT rows, and the name/ID handler performs its check in a new executor thread where a handler ThreadLocal would not propagate. Apply the override inside each handler/task or pass the role set explicitly before checking privileges.

}
} else {
if (nullptr != _param->common_param->user) {
table_params.__set_user(*(_param->common_param->user));
Expand Down
Loading
Loading