Access Control
Access control can be set up at various points in Pinot, such as controller endpoints and broker query endpoints. By default we will use AllowAllAccessFactory and hence not be enforcing any access controls. You can add access control by implementing the AccessControlFactory interface.
The access control factory can be configured in the controller configs by setting the fully qualified class name of the AccessControlFactory in the property controller.admin.access.control.factory.class
The access control factory can be configured in the broker configs by setting the fully qualified class name of the AccessControlFactory in the property pinot.broker.access.control.class. Any other properties required for initializing the factory can be set in the broker configs as properties with the prefix pinot.broker.access.control.
Querying logical tables
A logical table is authorized against its underlying physical tables, not against the logical table name. To query a logical table, the principal must have READ access to every physical table referenced by the logical table configuration; access to only some of them (or to the logical table name itself) is not sufficient. This applies to both the broker query endpoint and the controller /sql endpoint (including the query console).
For example, if the logical table orders maps to the physical tables ordersUS_OFFLINE, ordersEU_OFFLINE, and ordersAPAC_OFFLINE, a Basic Auth principal must be granted all three physical tables to query orders:
pinot.broker.access.control.principals.alice.tables=ordersUS_OFFLINE,ordersEU_OFFLINE,ordersAPAC_OFFLINERow-Level Security (RLS)
Row-Level Security (RLS) enables fine-grained access control at the row level, so that different users or service accounts see only the rows they are authorized to view. This is particularly useful in multi-tenant environments where a single table contains data belonging to multiple organizations, departments, or users.
With RLS enabled, the broker automatically rewrites each incoming query to inject additional WHERE-clause predicates based on the authenticated principal. The rewriting is transparent to the caller -- the original SQL is submitted as usual, and the broker appends the configured filters before execution.
How RLS works
A user submits a SQL query to the broker.
The broker authenticates the request and resolves the user principal.
The broker calls
getRowColFilters()on the configuredAccessControlimplementation to retrieve any RLS filters associated with the principal and the target table.If RLS filters exist, the
RlsFiltersRewriterinjects them into the query's WHERE clause using AND logic.The rewritten query is executed by the single-stage or multi-stage query engine.
If no RLS filters are configured for a given principal and table, the query is executed without modification.
Configuring RLS with Basic Auth
RLS filters are configured as part of the broker's Basic Auth principal definition. Each filter is a SQL predicate expression tied to a specific table.
The configuration key format is:
The value is parsed as a comma-separated list of filter predicates for that table. Pinot trims each predicate and combines them with AND.
Query rewriting example
Given the configuration above, when Alice runs:
The broker rewrites the query to:
The additional filter is combined with the original WHERE clause using AND. If multiple RLS filters are configured for the same table, they are all combined using AND logic.
Cross-table functions are rejected under row filters
RLS filters are applied only to the WHERE clause of the queried table, so functions that read rows from somewhere other than the FROM clause bypass them. To prevent a principal with row filters from reading or enumerating hidden rows through such a function, the single-stage broker rejects a query that calls any of the following functions when row filters apply to the queried table:
lookup()IN_SUBQUERYIN_PARTITIONED_SUBQUERY
The query is rejected with 403 Permission denied before any filters are added and before anything reaches a server, with a message of the form:
Principals without row filters are unaffected and can continue to use these functions.
Custom access control implementations
If you use a custom AccessControlFactory, you can support RLS by implementing the getRowColFilters() method on your AccessControl class. This method receives the RequesterIdentity and table name, and returns a TableRowColAccessResult containing the RLS filter predicates to apply.
Performance considerations
RLS filters are applied as additional WHERE-clause predicates. For best performance:
Ensure that columns referenced in RLS filters have appropriate indexes (inverted index, range index, or sorted index) to avoid full table scans. The server evaluates the RLS filter first, per segment, so that user expressions never run on hidden rows; without an index on the RLS columns this materializes a bitmap over the whole segment.
Keep filter predicates simple. Complex expressions or functions in RLS filters add overhead to every query for that principal.
Test the rewritten queries using the query explain plan to verify that indexes are being utilized.
The time spent materializing the RLS bitmap is tracked by the RLS_FILTER_TIME_MS server timer and reported as rlsFilterTimeMs in the server query log.
Debugging RLS
When RLS filters are applied to a query, the broker response includes a rlsFiltersApplied field set to true. This field appears in the standard broker query response JSON alongside other metadata fields like numDocsScanned and timeUsedMs. When no RLS filters are in effect, the field is set to false.
You can use this field to verify that RLS policies are being applied as expected. For more details on the broker response format, see Query Response Format.
Response statistics under RLS
To avoid revealing the layout of the full table to a principal who can only see a subset of its rows, a query with row-level security omits the table-layout statistics from its response. The following fields are reported as 0:
totalDocsnumSegmentsQueried,numSegmentsProcessed,numSegmentsMatchednumConsumingSegmentsQueried,numConsumingSegmentsProcessed,numConsumingSegmentsMatchednumSegmentsPrunedByBroker,numSegmentsPrunedByServer,numSegmentsPrunedInvalid,numSegmentsPrunedByLimit,numSegmentsPrunedByValue
If the broker cannot apply a configured RLS filter (for example, the filter predicate fails to parse), the query now fails with a QUERY_VALIDATION error instead of running without the filter. The error message does not include the policy text.
A query with row-level security does not use the single-stage broker's materialized-view rewrite.
Performance considerations
Last updated
Was this helpful?

