Part 7 · Catalogs and governance · Chapter 24
Governance: privileges, credential vending and lineage
How access control is enforced end to end: the privilege model and its inheritance rule, the authorization expression behind each API call, short-lived path-scoped credentials for engines, row filters and column masks, and lineage.
After this chapter you should be able to:
- Evaluate an access request against grants, ownership and the inheritance rule.
- Trace a read from the API call to the vended S3 credentials, and say exactly which objects those credentials reach.
- Explain row filters and column masks, where they are enforced, and why they block credential vending.
Chapter 23 built the securable tree. This chapter follows a request through it. An engine that wants to read sales.orders.orders makes two calls: one for the table’s metadata, one for credentials to its files. Each call is checked against the caller’s grants, and the second returns keys that reach that table’s directory and nothing else. Row filters and column masks add a third layer that only trusted compute can enforce.
The simulator in src/sim/uc/uc.ts implements the open-source server’s casbin matcher, transcribes its authorization expressions into functions that record each term, and ports its S3 session-policy generator. The tests pin which requests pass and which S3 requests the vended keys allow.
Privileges
The grant model. A grant is a triple: principal, securable, privilege. The open-source server stores grants as casbin policies and the securable tree as a second relation, g2, of parent-to-child edges. The whole decision is one matcher:[jcasbin_auth_model.conf]
m = (r.act != 'OWNER' && p.act == r.act && g(p.sub, r.sub) && g2(p.obj, r.obj))
|| (r.act == 'OWNER' && p.act == 'OWNER' && g(p.sub, r.sub) && r.obj == p.obj)
Read it as two rules. A non-OWNER privilege is satisfied by a grant on the object or on any ancestor, because g2 is transitive and reflexive. OWNER is satisfied only by ownership of that exact object. The edges come from creation: initializeHierarchicalAuthorization grants OWNER to the creator and adds the parent-to-child edge.[AuthorizedService][JCasbinAuthorizer] A catalog gets ownership but no edge from the metastore, so in the open-source server a metastore grant does not inherit.
Expressions per call. Each endpoint names a SpEL expression over #authorize, #authorizeAny and #authorizeAll. Reading a table’s metadata, from the UC REST API, the Delta API or Iceberg REST loadTable, is GET_TABLE:[AuthorizeExpressions.GET_TABLE]
#authorize(#principal, #metastore, OWNER) ||
#authorize(#principal, #catalog, OWNER) ||
(#authorize(#principal, #catalog, USE_CATALOG) && #authorize(#principal, #schema, OWNER)) ||
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorize(#principal, #schema, USE_SCHEMA) &&
#authorizeAny(#principal, #table, OWNER, SELECT, MODIFY))
The shape repeats in every expression: an owner high enough up passes, and everyone else needs a usage privilege at each container plus a privilege on the object. SELECT alone fails at the first term that needs USE CATALOG. The other table expressions:
| call | expression (after the owner shortcuts) |
|---|---|
commit, UPDATE_TABLE | USE CATALOG, USE SCHEMA, and OWNER or both SELECT and MODIFY on the table[UPDATE_TABLE] |
drop, DELETE_TABLE | OWNER on the catalog, or the schema with USE CATALOG, or the table with both usages; metastore OWNER alone is not enough[DELETE_TABLE] |
create, CREATE_TABLE | USE CATALOG, then OWNER or both USE SCHEMA and CREATE TABLE on the schema; for an external table, no overlap with a data securable and OWNER or CREATE EXTERNAL TABLE on the owning external location[CREATE_TABLE] |
credentials, VEND_TABLE_CREDENTIAL | USE CATALOG, USE SCHEMA, then for READ OWNER or SELECT on the table, for READ_WRITE OWNER or both SELECT and MODIFY[VEND_TABLE_CREDENTIAL] |
UPDATE_TABLE asks for SELECT alongside MODIFY because, in the source’s words, “a writer must also be able to read the table it commits to”. VEND_TABLE_CREDENTIAL has no owner shortcut above the table: an admin who owns the catalog can read the metadata and drop the table, but the UC and Delta credential endpoints give no keys to its files without a table-level privilege. (Iceberg REST, below, is the exception.)
Q1. In the open-source server's casbin model, which grants on a catalog reach the tables inside it?
Q2. ana has SELECT on sales.orders.orders and nothing else. Can ana read it?
Q3. What does GRANT USE CATALOG, USE SCHEMA, SELECT ON CATALOG sales TO finance give finance?
Q4. admin owns the catalog and schema but not the table, and holds no grants. Which can admin do?
Q5. Why does committing to a table (UPDATE_TABLE) require SELECT as well as MODIFY?
Credential vending
The catalog answers metadata requests, but the engine reads Parquet straight from S3. Giving every engine long-lived keys to the bucket would make the catalog’s checks advisory. Instead the server vends credentials: after VEND_TABLE_CREDENTIAL passes, it mints temporary keys that reach only the table’s location.
In the open-source server the call is POST /temporary-table-credentials with a table id and an operation, and the Delta API’s credentials endpoint uses the same expression.[api/all.yaml: generateTemporaryTableCredentials][DeltaApiService] Iceberg REST works differently, because its loadTable and loadCredentials only carry a read decision: they are guarded by GET_TABLE, and the server then picks the scope imperatively, READ_WRITE for a native Iceberg table if the caller owns it or holds SELECT and MODIFY on it, READ otherwise, and always READ for a Delta table read through UniForm.[IcebergRestCatalogService.getLoadCredentialPrivileges] The service maps READ to the SELECT privilege set and READ_WRITE to SELECT plus UPDATE, then calls the vendor with the table’s storage URL.[TemporaryTableCredentialsService] On AWS, the vendor assumes the storage credential’s IAM role with STS, passing a session policy and a one-hour duration:[AwsCredentialGenerator.generate]
String awsPolicy = AwsPolicyGenerator.generatePolicy(ctx.getPrivileges(), ctx.getLocations(), roleArn, awsRegion);
AssumeRoleRequest.builder()
.roleArn(roleArn)
.policy(awsPolicy)
.roleSessionName("uc-%s".formatted(UUID.randomUUID()))
.durationSeconds((int) Duration.ofHours(1).toSeconds());
An STS session policy can only narrow the role’s permissions, so the role may cover a whole bucket while the keys cover one table. generatePolicy builds it:[AwsPolicyGenerator.generatePolicy]
- One statement allows the object actions:
s3:GetObjectfor SELECT, andGetObject,PutObject,DeleteObject,AbortMultipartUploadandListMultipartUploadPartsfor UPDATE.[AwsPolicyGenerator actions] Its resources are, for each path,arn:aws:s3:::<bucket>/<path>/*andarn:aws:s3:::<bucket>/<path>. - For each bucket, a statement allows
s3:ListBucketon the bucket with a conditions3:prefixin<path>,<path>/and<path>/*. - A KMS statement allows decrypt (and, for UPDATE, encrypt) through S3 only.
- Engine requests access Send a table ID and the requested operation.
- Catalog checks privileges Resolve the table’s storage location and permitted access.
- Vendor issues credentials Mint temporary, path-scoped credentials for the operation.
- Engine reads storage Use those credentials to fetch data files directly.
The /* after the path is what keeps a sibling out: tables/7d40-old/part-0.parquet starts with the same characters as tables/7d40 but does not match tables/7d40/*. There is no s3:DeleteObject for readers, and no ListBucket outside the prefix, so a reader cannot even discover other tables’ files. When a commit adds files (chapter 10), the writer uses the same keys, and when they expire after an hour it asks again, passing the check again.
Q1. An engine gets READ credentials for a table at s3://lake/.../tables/7d40. Which request succeeds?
Q2. How long do credentials vended by the open-source server on AWS last, and how are they scoped?
Q3. On Databricks, what is required or excluded when an external engine asks for vended credentials? (select all that apply)
Fine-grained access
Grants decide whether a principal may read a table at all. Row filters and column masks decide which rows and values it sees. Both are Databricks features built from Unity Catalog SQL functions:[Databricks docs: row filters and column masks]
CREATE FUNCTION region_filter(region STRING)
RETURN is_account_group_member('admins') OR region = 'US';
ALTER TABLE orders SET ROW FILTER region_filter ON (region);
CREATE FUNCTION email_mask(email STRING)
RETURN CASE WHEN is_account_group_member('pii_readers') THEN email ELSE '***' END;
ALTER TABLE orders ALTER COLUMN email SET MASK email_mask;
The engine rewrites every query on the table: it keeps a row only if the filter returns true for that row’s column values, and replaces each value of a masked column with the mask’s result. Functions like is_account_group_member are evaluated for the user running the query, so the same table returns different results to different users.
That design dictates where enforcement can happen. The policy lives in a function, and the function is run by the engine, so only an engine the catalog trusts to run it may read the files. A client holding raw keys could read every row and every unmasked value. This is why vending excludes these tables. The docs list the other limits that follow: filters and masks cannot be set on views, and a table that has them cannot be read by path, with time travel, or by external engines through the REST APIs, except through cross-engine ABAC policies.
Q1. Why can't a table with a row filter be read with vended credentials?
Q2. How do you attach a column mask?
Lineage and audit
Because every read and write goes through the catalog’s names, Databricks can record which tables and columns each query read and wrote. Lineage is captured automatically, down to the column level, and appears in the Catalog Explorer and in system tables.[Databricks docs: data lineage] system.access.table_lineage and system.access.column_lineage record read and write events with columns such as the source and target full names, the type of entity that ran the query, and the event time, over a rolling 395-day window; data before September 1, 2024 is not available. Functions get table-level lineage only.[Databricks docs: lineage system tables]
SELECT source_table_full_name, target_table_full_name, entity_type, event_time
FROM system.access.table_lineage
WHERE target_table_full_name = 'sales.orders.orders'
ORDER BY event_time DESC;
Lineage is a Databricks feature: the open-source server at the pin has no lineage store. Engines that read through vended credentials are only visible to the catalog at the moment they ask for keys.
Q1. Where can you query Databricks' captured table lineage?
Try it
- Access check: as
anawith USE CATALOG and SELECT on the table, run GET table and watch it fail at USE SCHEMA. Add USE SCHEMA. Then try READ_WRITE credentials and add MODIFY. Switch toadminand compare GET, DROP TABLE and vend READ. Switch toetl, the table’s owner, with no grants, and see which requests the missing USE CATALOG blocks. - Vended credential: switch between READ and READ_WRITE and see which S3 requests the keys allow.
- Row filter and mask: toggle the querying user’s groups.
GRANTs to ana. Ownership comes from creating the object and is fixed here.
Expression GET_TABLE, terms in evaluation order:
- ✗ OWNER on metastore
- ✗ OWNER on catalog
- ✓ USE CATALOG on catalogvia USE CATALOG granted on cat_sales
- ✗ OWNER on schema
- ✓ USE CATALOG on catalogvia USE CATALOG granted on cat_sales
- ✗ USE SCHEMA on schema
PERMISSION_DENIED
Summary
- A non-OWNER privilege is satisfied by a grant on the object or any ancestor; OWNER only by owning that object. Edges come from creation, and there is none from the metastore to a catalog.
- Each API call has one expression. Reading needs USE CATALOG, USE SCHEMA and a table privilege; committing needs SELECT and MODIFY; credentials need a table-level privilege that matches the operation, with no shortcut for owners higher up.
- Vended AWS credentials come from STS AssumeRole with a session policy that allows only the operation’s actions on
<path>and<path>/*, for one hour. - Row filters and column masks are SQL functions the engine runs as the querying user, so tables that use them are readable only through compute that enforces them, never through vended keys.
- Databricks records table and column lineage automatically and exposes it in
system.accesstables.
Concepts in this chapter
Explained here
Primary sources
Review this chapter
This chapter has 11 quiz questions.