{
"type": "FORMULA_VARIABLE",
"name": "country_var",
"is_sensitive": false,
"data_type": "VARCHAR"
}
ABAC via RLS with variables
Attribute-Based Access Control (ABAC) is an access control model in which security entitlements are assigned to a ThoughtSpot user directly as a set of attributes with lists of values, rather than relying on a JOINed entitlements table within the data model.
ThoughtSpot allows assigning attribute values to a user at session creation time by adding the values to the userβs access token request.
RLS rules are defined on table objects, which bind dynamically generated WHERE clauses to any generated query. Within RLS rules, attributes are referenced by their variable names using the ts_var() function to dynamically filter data and enable user-specific security policies.
Overviewπ
RLS rules have a defined set of system variables such as ts_username or ts_groups. Once ABAC via RLS is enabled, the ts_var() formula is available within the RLS rule editor to refer to any defined Formula variable within ThoughtSpot.
Formula variables are custom variables defined within ThoughtSpot that enable dynamic and context-aware logic in RLS rules. They are assigned at the user level during session creation for the ABAC pattern, although they can be set at Org and data model levels as well.
Supported operatorsπ
RLS rules that use the ts_var() function support only equal to (=) and not equal to (!=) operators. Internally, = translates to IN (β¦β) and != translates to NOT IN (β¦β) in the generated SQL, because ts_var() returns a list of values.
Inequality comparison operators such as > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to) are not supported and do not resolve in RLS rules.
Numerical operators, such as addition (+), subtraction (-), multiplication (*), and division (/), are also not supported with ts_var(). You cannot perform arithmetic on the value returned by ts_var() or use it within a calculated expression in an RLS rule.
Implementation stepsπ
The ABAC implementation with formula variables and RLS rules includes the following steps:
-
Creating formula variables
To generate tokens with variable attributes, the variables must be available in ThoughtSpot. To create variables, use the Variable REST API. -
Adding RLS rules with formula variables
When defining an RLS rule with variables, use thets_varfunction. These RLS rules will apply to the Models, Liveboards, and other objects derived from that Table. A formula variable must be defined before it can be used in an RLS rule. -
Creating a token request with variable attributes
Attribute values are assigned to users by requesting a token using the/api/rest/2.0/auth/token/customREST API endpoint. -
Verifying entitlements
To ensure data security rules are applied, check user entitlements and verify that they are translated accurately during query generation. Variables and their assigned values are visible to administrators using the/api/rest/2.0/template/variables/searchendpoint with theresponse_contentparameter set toMETADATA_AND_VALUES.
Indexingπ
Several features within ThoughtSpot, such as autocompletion in Search on values within columns, use ThoughtSpot indexing. Due to the runtime nature of ABAC tokens, ThoughtSpot indexing will not be restricted by the values supplied in a token. This means the indexed columns may expose values in search suggestions or autocompletion that a user should not see, even if ABAC filters would block access to the underlying data. To prevent this, you can do one of the following:
-
Disable indexing for columns and fields that must be restricted by ABAC. You may also want to disable indexing on all sensitive columns.
-
Define an RLS rule on those fields, since RLS is enforced at the indexing layer and will secure suggestions and sample values.
Create formula variablesπ
Formula variables must be defined in ThoughtSpot before they can be used in any RLS rule via the ts_var() formula.
To view the variables available on your instance, use the POST /api/rest/2.0/template/variables/search API call.
To create a new variable, use the /api/rest/2.0/template/variables/create API endpoint.
To configure formula variables for all Orgs on your instance or the Primary Org, cluster administration privileges are required. Org administrators can configure formula variables for their respective Orgs. Users with the CAN_MANAGE_VARIABLES (Can manage variables) role privilege can also create and manage variables for their Org context.
The /api/rest/2.0/template/variables/create API endpoint allows creating formula variables for the following data types:
-
VARCHAR -
INT32 -
INT64 -
DOUBLE -
DATE -
DATE_TIME
During variable creation, specify the data_type.
Formula variables for BOOLEAN and TIME data types are not supported.
The variable update API (/api/rest/2.0/template/variables/{identifier}/update) allows updating the variable name and other attributes of the variable definition, but not the values assigned to users or other principals.
Variable values are set either by generating a token using the /api/rest/2.0/auth/token/custom API endpoint or via the Update Variable Values REST API.
Add or update RLS rules with variable referencesπ
RLS rules are defined on Table objects:
-
Navigate to the Data workspace and click the Table for which to define RLS rules.
-
Click Row security and then click + Add row security.
-
In the Row Security Editor, define the rules. To reference the formula variable in the rule, use the
ts_var(varName)function, with no quotes around the formula variable name. For example, to limit a column calledregionto the values set in a formula variable calledregion_var, set the RLS rule to:region = ts_var(region_var).
|
Note
|
|