Starburst (Trino) Integration
The Starburst (Trino) integration allows you to access policy-enforced data directly in your Starburst catalogs without rewriting queries or changing workflows. Instead of generating policy-enforced views and adding them to an Immuta catalog that users have to query (like in the legacy Starburst (Trino) integration), Immuta policies are translated into Starburst (Trino) rules and permissions and applied directly to tables within users’ existing catalogs.
Architecture
Once an Immuta Application Admin configures the Starburst (Trino) integration, the ImmutaSystemAccessControl plugin is installed on the coordinator. This plugin provides policy decisions to the Trino Execution Engine whenever an Immuta user queries a Starburst (Trino) table registered in Immuta. Then, the Trino Execution Engine applies policies to the backing catalogs and retrieves the data with appropriate policy enforcement.
By default, this integration is designed to be minimally invasive: if a catalog is not registered as an Immuta data source, users will still have access to it in Starburst (Trino). However, this limited enforcement can be changed in the configuration file provided by Immuta. Additionally, you can continue to use Trino's file-based access control provider or Starburst (Trino) built-in access control system on catalogs that are not protected or controlled by Immuta.
Policy enforcement
When a user queries a table in Starburst (Trino), the Trino Execution Engine reaches out to the Immuta plugin to determine what the user is allowed to see:
- masking policies: For each column, Starburst (Trino) requests a view expression from the Immuta plugin. If there is a masking policy on the column, the Immuta plugin returns the corresponding view expression for that column. Otherwise, nothing is returned.
- row-level policies: For each table, Starburst (Trino) requests the rows a user can see in a table from Immuta. If there is a WHERE clause policy on the data source, Immuta returns the corresponding view expression as a WHERE clause. Otherwise, nothing is returned.
The Immuta plugin then requests policy information about the tables being queried from the Immuta Web Service and sends this information to the Trino Execution Engine. Finally, the Trino Execution Engine constructs the SQL statement, executes it on the backing tables to apply the policies, and returns the response to the user.
See the integration support matrix on the Data policy types reference guide for a list of supported data policy types in Starburst (Trino).
System access control providers
Users cannot bypass Immuta controls
Users cannot bypass Immuta controls by changing roles in their system access control provider.
Multiple system access control providers can be configured in the Starburst (Trino) integration. This approach allows Immuta to work with existing Starburst (Trino) installations that already have an access control provider configured.
Immuta does not manage all permissions in Starburst (Trino) and will default to allowing access to anything Immuta does not manage so that the Starburst (Trino) integration complements existing controls. For example, if the Starburst (Trino) integration is configured to allow users write access to tables that are not protected by Immuta, you can still lock down write access for specific non-Immuta tables using an additional access control provider.
If you have multiple access control providers configured, those providers interact in the following ways:
-
For a user to have access to a resource (catalog, schema, or a table), that user must have access in all of the configured access control providers.
-
In catalog, schema, or table filtering (such as
show catalogs
,show schemas
, orshow tables
), the user will see the intersection of all access control providers. For example, if a Starburst (Trino) environment includes the catalogspublic
,demo
, andrestricted
and one provider restricts a user from accessing therestricted
catalog and another provider restricts the user from accessing thedemo
catalog, runningshow catalogs
will only return thepublic
catalog for that user. -
Only one column masking policy can be applied per column across all system access control providers. If two or more access control providers return a mask for a column, Starburst (Trino) will throw an error at query time.
-
For row filtering policies, the expression for each system access control provider is applied one after the other.
See the Starburst (Trino) integration configuration page for instructions on configuring multiple access control providers.
Starburst (Trino) query passthrough
Starburst (Trino) query passthrough is available in most connectors using the query
table function or raw_query
in the
Elasticsearch connector. Consequently, Immuta blocks functions named raw_query
or query
, as those table functions
would completely bypass Immuta’s access controls.
For example, without blocking those functions, this query would access the public.customer
table directly:
select * from table(postgres.system.query(query => 'select * from public.customer limit 10'));
You can add or remove functions that are blocked by Immuta in the Starburst (Trino) integration configuration file. See the Starburst (Trino) integration configuration page for instructions.
Data flow
- An Immuta Application Administrator configures the Starburst (Trino) integration, adding the ImmutaSystemAccessControl plugin on their Starburst (Trino) node.
- A data owner registers Starburst (Trino) tables in Immuta as data sources. A data owner, data governor, or administrator creates or changes a policy or user in Immuta.
- Data source metadata, tags, user metadata, and policy definitions are stored in Immuta's Metadata Database.
- A Starburst (Trino) user who is subscribed to the data source in Immuta queries the corresponding table directly in their Starburst catalog.
- The Trino Execution Engine calls various methods on the interface to ask the ImmutaSystemAccessControl plugin where the policies should be applied. The masking and row-level security methods apply the actual policy expressions.
- The Immuta System Access Control plugin calls the Immuta Web Service to retrieve policy information for that data source for the querying user, using the querying user's project, purpose, and entitlements.
- The Immuta System Access Control plugin provides the SQL view expression (for masked columns) or WHERE clause SQL view expression (for row filtering) to the Trino Execution Engine.
- The Trino Execution Engine constructs and executes the SQL statement on the backing catalogs and retrieves the data with appropriate policy enforcement.
- User sees policy-enforced data.
Authentication methods
The Starburst (Trino) integration supports the following authentication methods to create data sources in Immuta:
- Username and password: You can authenticate with your Starburst (Trino) username and password.
- OAuth 2.0: You can authenticate with OAuth 2.0. Immuta's OAuth authentication method uses the Client Credentials Flow; when you register a data source, Immuta reaches out to your OAuth server to generate a JSON web token (JWT) and then passes that token to the Starburst (Trino) cluster.
OAuth Authentication for creating data sources
Configure JWT authentication method in Starburst (Trino)
When using OAuth authentication to create data sources in Immuta, configure your Starburst (Trino) cluster to use JWT authentication, not OpenID Connect or OAuth.
When users query a Starburst (Trino) data source, Immuta sends a username with the view SQL so that policies apply in the right context. Since OAuth authentication does not require a username to be associated with a data source upon data source creation, Immuta does not send a username and Starburst (Trino) queries fail. To avoid this error, you must configure a global admin username.
If you are using OAuth or asynchronous authentication to create Starburst (Trino) data sources, see the
Starburst (Trino) configuration guide
to set the
globalAdminUsername
property in the advanced configuration section of the Immuta app settings page.
Supported Starburst (Trino) feature
Starburst (Trino)-created logical view support
Immuta policies can be applied to Starburst (Trino)-created logical views.
The descriptions below provide guidance for applying policies to Starburst (Trino)-created logical views in the
However, there are other approaches you can use to apply policies to Starburst (Trino)-created logical views. The examples below are the simplest approaches.
Views created in the DEFINER
security mode
For views created using the DEFINER
security mode,
- ensure the user who created the view is configured as an admin user in the Immuta plugin so that policies are never applied to the underlying tables.
- create Immuta data sources and apply policies to logical views exposing those tables.
- lock down access to the underlying tables in Starburst (Trino) so that all end user access is provided through the views.
Views created in the INVOKER
security mode
Applying Policies to Views or Tables
Avoid creating data policies for both a logical view and its underlying tables. Instead, apply policies to the logical view or the underlying tables.
For views created using the INVOKER
security mode, the querying user needs access to the logical view and
underlying tables.
-
If non-Immuta table reads are disabled, provide access to the views and tables through Immuta. To do so, create Immuta data sources for the view and underlying tables, and grant access to the querying user in Immuta. If creating data policies, apply the policies to either the view or underlying tables, not both.
-
If non-Immuta table reads are enabled, the user already has access to the table and view. Create Immuta data sources and apply policies to the underlying table; this approach will enforce access controls for both the table and view in Starburst (Trino).
Supported Immuta features
- User impersonation: Native impersonation allows users to natively query data as another Immuta user. To enable native user impersonation, see the Integration user impersonation page.
- Native query audit: Immuta audits queries run natively in Starburst (Trino) against Starburst (Trino) data registered as Immuta data sources.
- Multiple Starburst (Trino) instances
Native query audit
The Immuta Trino Event Listener allows
Immuta to translate events into comprehensive audit logs for users with the Immuta
AUDIT
permission to view. For more information about what is included in those audit logs, see the
Starburst (Trino) Audit Logs page.
In addition to the information included on the Starburst (Trino) Audit Logs page, the audit logs payload in the
Starburst (Trino) integration includes immutaPlanningDuration
, which represents the planning overhead in Immuta.
Multiple Starburst (Trino) integrations
You can configure multiple Starburst (Trino) integrations with a single Immuta tenant and use them dynamically. Configure the integration once in Immuta to use it in multiple Starburst (Trino) clusters. However, consider the following limitations:
- Names of catalogs cannot overlap because Immuta cannot distinguish among them.
- A combination of cluster types on a single Immuta tenant is supported unless your Trino cluster is configured to use a proxy. In that case, you can only connect either Trino clusters or Starburst clusters to the same Immuta tenant.
Policy caveat
Limit your masked joins to columns with matching column types. Starburst truncates the result of the masking expression to conform to the native column type when performing the join, so joining two masked columns with different data types produces invalid results when one of the columns' lengths is less than the length of the masked value.
For example, if the value of a hashed column is 64 characters, joining a hashed varchar(50) and a hashed varchar(255) column will not be joined correctly, since the varchar(50) value is truncated and doesn’t match the varchar(255) value.