You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gravitino.apache.org by "bharos (via GitHub)" <gi...@apache.org> on 2026/08/26 00:59:25 UTC

Re: [D] Design input needed - where should tag-based access control live? [gravitino]

GitHub user bharos edited a discussion: Design input needed - where should tag-based access control live?

I am working on a design for tag-based access control in Gravitino. Before I finalize it,
there is one structural decision I would like consensus on before proceeding, so it would be great to get some inputs here than me bringing a design that has already assumed an answer.

Grants today are object-identified, and authorization never reads tags. So there is no way
to express something like:

> role `analyst` may read tables tagged `certified` in schema `lakehouse.finance`

I would like to add an access rule of the shape
`(principal, action, effect, tag condition, scope)`, evaluated inside the existing
authorization-expression path. With policy-on-tag merged, there are two plausible homes for
it.

**Option A — an `access_control` policy type**, reusing `Policy` and the policy-tag
relation. Principal, action and effect live in the policy's `content`; the authorizer calls
`ObjectPolicyResolver` and keeps policies of that type. Almost no new plumbing.

```http
POST /api/metalakes/prod/policies
{ "name": "analyst_can_read", "policyType": "access_control", "enabled": true,
  "content": { "role": "analyst", "action": "SELECT_TABLE", "effect": "ALLOW" } }

PUT /api/metalakes/prod/tags/certified/policies/analyst_can_read
{ "selector": { "type": "ALL_VALUES" } }
```

**Option B — a separate entity** with principal, action, effect and scope as columns,
reading tags directly rather than through `Policy` or `ObjectPolicyResolver`. It would
reuse `PolicySelector` so both features express tag conditions the same way. Costs a new
table across three dialects, a REST resource and client support.

```http
POST /api/metalakes/prod/tag-access-policies
{ "principal": { "type": "ROLE", "name": "analyst" },
  "objectType": "TABLE", "action": "SELECT_TABLE", "scope": "lakehouse.finance",
  "effect": "ALLOW",
  "requireTags": [ { "tag": "certified", "selector": { "type": "ALL_VALUES" } } ] }
```

## Which authority should create an access rule?

Under A, creating that rule needs `APPLY_POLICY` on the policy and `APPLY_TAG` on the tag.
It needs no permission on the objects the rule affects — the call names no object — and
does not involve `MANAGE_GRANTS`, which governs granting privileges today via
`hasMetadataPrivilegePermission`. The rule still grants `SELECT_TABLE` on every object
carrying the tag.

Scope differs too. `APPLY_TAG` binds only at `METALAKE` / `TAG` and `APPLY_POLICY` only at
`METALAKE` / `POLICY` (`ApplyTag.canBindTo`), so access rules could only be administered
metalake-wide. `MANAGE_GRANTS` binds at every object type, and its binding at a parent covers all children.
Under B the create is checked against the rule's
`scope`, so it can use whichever authority the project considers correct and be delegated
per catalog or schema.

**Is `APPLY_POLICY` + `APPLY_TAG` the intended authority for creating access rules, or
should they require grant authority on the data they affect?**

## A related point: principal and effect

Neither has a home in policy-on-tag today — the relation has no principal column (the
policy-on-tag doc(https://github.com/apache/gravitino/pull/12177) says the selector "does not support ... principals, scopes, or general
expressions"), and `enabled` / disabled is not allow / deny.

- **Under A** both would live inside the policy's opaque `content` (like a JSON text), so rules cannot be
  looked up by role, and deleting a role leaves rules behind that still name it - a later
  role created with the same name silently inherits them.
- **Under B** both are columns, so they can be indexed and can cascade on role deletion.

Guidance on either point would help a lot before I take the design further.


GitHub link: https://github.com/apache/gravitino/discussions/12619

----
This is an automatically sent email for dev@gravitino.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@gravitino.apache.org