trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.41k stars 3k forks source link

Missing enabled system roles in identity passed to checkCanExecuteQuery #20544

Open Laonel opened 9 months ago

Laonel commented 9 months ago

DispatcherManager makes a call to AccessControl.checkCanExecuteQuery using the identity from SessionContext. When the support for system roles was added in https://github.com/trinodb/trino/pull/9087, resolving enabled system roles was implemented in QuerySessionSupplier. Because of this, the identity passed to checkCanExecuteQuery will miss the enabled roles when all roles are enabled. This can lead to access denied if privilege to execute queries is not given to the user directly, but provided by one of the applicable roles.

Should the call to checkCanExecuteQuery be changed to use the decoded Session object?

Laonel commented 9 months ago

CC @dain