Skip to content

How Policies Combine

Overview

A data platform enforces one row filter per table and one mask per column. The row filters and masks on a table in a data product can come from four places:

  1. Policies on the resource itself
  2. Tag-based policies
  3. Data product policies
  4. The purpose applied to the data product, for the groups and roles it is applied for

Trust3 AI merges them into one row filter per table and one mask per column, in a fixed order, before the connector writes them to the platform. The same policies always give the same result, whatever order they were created in.

A purpose adds its row filters and masks where it has them and leaves everything else as the other policies have it. For example, if the data product masks columns X and Y and the purpose masks column Z, the purpose's groups and roles see X, Y and Z masked. A purpose's row filters can only remove rows. Its masks take precedence on the columns they cover, so a purpose can also show a column that another policy masks. A purpose does not change the other policies themselves, and its policies apply only to the groups and roles it is applied for.

Row filters

Row filters are combined by these rules:

  • Filters that keep rows (Allow) on the same column are combined with OR.
  • Filters on different columns are combined with AND.
  • A filter that removes rows (Exclude) is kept whole and combined with the others using AND. Two Exclude filters on the same column both apply: Filter out population A and Filter out population B together remove both populations.
  • A filter that uses several columns is kept as one unit and combined with the others using AND. It is never split.
  • A purpose's own filters are combined by the same rules.
  • The purpose's filters are combined with the result of all the other filters using AND. A purpose can only remove rows.

OneLake

On OneLake (Microsoft Fabric), row filters from resource, tag and data product policies are not combined by default. There, only the first row filter for a group or role applies, as before.

Two more rules decide which rows a filter matches:

  • Empty values. A row whose column is NULL matches no comparison in a Record Identifier's filter. So an Exclude filter removes it, and an Allow filter that compares the column does not keep it. To keep such rows, include IS NULL for that column in the Record Identifier's filter.
  • A tag on several columns. A mask applies to every column with its tag.

Example: a purpose cannot bring rows back

A Customers table holds customers 1 to 10.

Step Rows seen
Data product policy: US customers only 2, 4, 6, 8, 10
Marketing purpose: remove customers without consent (customers 4 and 5) 2, 6, 8, 10

Customer 5 was already hidden by the data product policy. The purpose cannot bring it back.

Example: two purposes on one data product

A claims table holds members 1 to 10. Members 1 to 5 are in population A, and members 6 to 10 are in population B. Members 3 and 7 have not given consent.

Who Policies on rows Rows seen
Data product policy, for everyone Filter out members without consent 1, 2, 4, 5, 6, 8, 9, 10
Claims Processing purpose None 1, 2, 4, 5, 6, 8, 9, 10
Research purpose Filter out population B 1, 2, 4, 5

Claims Processing has no row policy, so it sees the rows the data product allows. Research's filter is combined with the data product's filter using AND, so it sees only the consenting members of population A. Members 6, 8, 9 and 10 are removed by the purpose. Members 3 and 7 were already removed by the data product.

Example: a filter on several columns

Two filters apply to the same table:

  • region = 'us-east' OR country = 'UK'
  • country = 'US'

The first filter uses two columns, so it is kept as one unit and combined with the second using AND. The result returns no UK rows:

SQL
(region = 'us-east' OR country = 'UK') AND country = 'US'

A filter that is a single condition on one column, or an OR of conditions on that same column, is grouped with the other filters on that column. For example, country = 'US' OR country = 'CA' is grouped with another filter on country.

Column masks

Only one mask can apply to a column, so one has to win. The order is:

  1. Purpose
  2. Tag-based policy
  3. Data product policy
  4. Resource policy

If two policies at the same level mask the same column, the policy whose name sorts first wins. Names are compared with upper and lower case kept distinct, so renaming a policy can change which mask wins. Avoid giving two policies at the same level masks on the same column.

A policy that reaches a column in more than one way, for example through both a tag and the data product, ranks at the highest of those levels.

The purpose's mask always wins

A purpose's mask is the result for the purpose's groups and roles, even when it is weaker than the mask it replaces. This includes "don't mask", which shows the column in the clear.

This is how an approved exception works. For example, a tag-based policy masks every column tagged as an SSN for everyone. A Claims Processing purpose with a "Show SSN" policy is applied to a data product for the claims team. The claims team sees SSNs in that data product, and the column stays masked for everyone else.

Example: one column, three masks

Three policies cover the SSN column, and no resource policy does:

Level Policy
Purpose Show SSN
Tag-based policy Redact SSN
Data product policy Show last 4
Who Sees Why
Groups and roles the purpose is applied for 123-45-6789 The purpose's mask wins, including Show.
Everyone else ***-**-**** The tag-based policy ranks above the data product policy.

Because a purpose can unmask a column, review a purpose's "don't mask" policies before applying it.

When a user holds several roles

The rules above give one row filter and one mask for each group or role. A user who holds several roles gets a result from each, and on Snowflake these are combined as follows:

  • Rows. The rows given to the user's roles that a row filter names add up. A role that no row filter names gives every row only to users who hold none of the named roles. An Exclude filter is part of the rows of the role it is written for, so another role the user holds can give those rows back. A purpose's row filters are then applied for anyone holding a role the purpose is applied for.
  • Masks. Of the masks from resource, tag and data product policies, the least restrictive across the user's roles applies. Where a purpose masks the column for one of the user's roles, the purpose's mask applies instead. If the user holds roles of several purposes that mask the same column, the strictest of those purpose masks applies. This last rule is interim and may change. Within one Snowflake role, such as a Trust3 AI role and a group with the same name, purpose masks on the same column are chosen by policy name instead.

Planned: Exclude filters for everyone they name

An Exclude filter will apply to every user who holds a role it names, and another role will not widen it.

The level order in Column masks applies within one role. For example, a user whose role X is covered by a tag policy that redacts SSNs, and whose role Y is covered by a data product policy that shows the last 4 digits, sees the last 4 digits: across roles, the least restrictive mask applies.

Contradictory policies in a purpose

A purpose can hold policies that contradict each other, such as Filter out population B and Show population B, or Redact SSN and Show SSN.

For rows, contradictory filters show nothing today. Filter out population B is an Exclude filter, so it is combined with Show population B using AND, and no row can match both. The purpose's groups and roles see no rows at all.

Planned: contradictory masks stay masked

When a purpose holds two masks for the same column that contradict each other, such as Redact SSN and Show SSN, the column will stay masked.

Until this is available, two masks of a purpose on the same column follow the tie rule above, by policy name. Avoid putting contradictory policies in one purpose.

What changes for existing policies

From 9.2.50.1, the connectors built on Omni change some behavior that earlier versions had. The first three rows (combining row filters, ordering masks and which roles are checked on Snowflake) apply to every Omni tenant, whether or not PBAC is enabled. The other rows apply only when PBAC is enabled.

Area Before From 9.2.50.1 Needs PBAC
Several row filters for the same group or role Only the first filter applies Allow filters on the same column are combined with OR; other filters are combined with AND. Trust3 AI Customer Support can turn this off for a data platform. No
Masks from resource, tag and data product policies on the same column The policy order of Apache Ranger Level, then policy name, as described in Column masks No
Which roles are checked on Snowflake Roles active in the session Every role the user holds, directly or through another role. See PBAC on Snowflake. No
A purpose's mask Lowest precedence, as in Apache Ranger Highest precedence Yes
Data product tables, for a user that no rule names Sees every row Planned: sees no rows. See PBAC on Snowflake. Yes
How purpose policies find columns Not applicable By tag, so one rule works across tables whose columns have different names Yes