World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
title: "Access Control" slug: "/security/access-control" keyword: "security" license: "This software is licensed under the Apache License version 2."
Overview
Apache Gravitino federates the catalogs of many systems under a single metalake, so permissions are defined once there rather than separately in each system. When authorization is enabled, the server checks every request before the operation runs and rejects it if the caller is not entitled to it.
Two things decide the answer:
- Ownership comes with creation. Whoever creates an object owns it, and owning it carries the right to alter it, drop it, and hand it to someone else. Ownership reaches down, so owning a catalog means administrative control over the schemas and tables inside it.
- Privileges are named permissions, each authorizing one kind of operation:
SELECT_TABLEreads a table,CREATE_SCHEMAcreates a schema in a catalog. A privilege is never given to a person directly. Privileges are collected into a role, and the role is granted to users and to groups.
Three rules govern how those apply:
- Grants reach downward. A grant covers everything beneath the object it is made on, both what
exists now and what is created later.
SELECT_TABLEon a schema covers every table in it. - Nothing is permitted unless granted. A user added to a metalake and given nothing can see the metalake and nothing else.
- An explicit deny overrides everything. Each privilege in a role carries an
ALLOWor aDENYcondition, and aDENYbeats anALLOWheld in any other role and at any other level of the hierarchy. A denial cannot be undone by granting something elsewhere, which makesDENYthe way to carve one object out of a broad grant.
Quick Start
Authorization is off by default. Turn it on in ${GRAVITINO_HOME}/conf/gravitino.conf, name at least
one service administrator, and restart the server:
gravitino.authorization.enable = true
gravitino.authorization.serviceAdmins = {admin_user}
Service administrators are the only users who can create metalakes, and everything after that is done through the API. The Walkthrough runs a full sequence end to end, from an empty server to a user with read access to one schema. Server Configuration covers the remaining settings, including how a caller's identity reaches the server.
Authorization Model
Principals and Objects
Users and Groups
A user must be added to a metalake before it can do anything there. A group is a set of users, and a role granted to a group applies to every member, which is how access is usually managed for a team.
Both carry an optional externalId correlating them with an external identity provider. Users also
have an enabled flag, which suspends access without removing the user and defaults to true when
the user is created with an externalId.
Service Administrators
A service administrator is an ordinary user whose name appears in
gravitino.authorization.serviceAdmins. They are added to metalakes, granted roles, and made owners
like anyone else. The list adds exactly one ability, creating a metalake, and being server
configuration rather than a role it cannot be granted or revoked through the API. The check reads the
list alone, which is what lets the first metalake be created before any membership exists.
Objects
Everything Gravitino manages is an object with a type and a name. The name is the dotted path to it
below the metalake, so a table is {catalog}.{schema}.{table}, and requests identify an object by
both type and name, since the same name can exist at more than one type.
Local names containing one or more dots {#names-containing-dots}
::::caution
When authorization is enabled, Gravitino cannot authorize a federated object whose local name
contains one or more dots (.), because dots separate the components of a qualified metadata object name.
Loading such an object returns 400 Bad Request. If a connector returns one of these objects in a
list, Gravitino rejects the entire list request with 400 Bad Request and identifies the unsupported
name instead of returning a partial result. Consequently, one object with a dotted name can prevent
all sibling objects from appearing in list APIs.
Rename or recreate the object in the source system with a name that does not contain dots before using it with authorization. When authorization is disabled, existing source objects whose names are supported by the connector can still be listed and loaded. ::::
Access to an object is controlled by privileges, granted through roles, and by ownership. Ownership behaves like a privilege that arrives with the object rather than one you grant, and it carries the administrative rights, altering, dropping, and transferring, that no privilege name covers.
Everything sits under a metalake, but only the data objects nest below a catalog:
Metalake (top level)
├── Catalog (represents a data source)
│ └── Schema
│ ├── Table
│ ├── View
│ ├── Topic
│ ├── Fileset
│ ├── Model
│ ├── Function
│ └── Semantic Model
├── Domain
│ └── Subdomain
├── Tag
├── Policy
├── Job Template
├── Role
└── Job
Three things about that tree are worth noting:
- Roles and jobs are controlled by ownership alone, since no privilege binds to them, though
CREATE_ROLEandRUN_JOBon the metalake gate creating them. - Columns do not appear at all. They are reached through their table and carry no controls of their own, so there is no column-level grant in this model.
- Users and groups are not objects. They are the principals that privileges and ownership are assigned to.
Grants
Privileges
A privilege authorizes a specific operation on an object, for example SELECT_TABLE or
CREATE_SCHEMA. Privileges are added to roles, and roles are granted to users and groups. Privileges
are never granted directly to a user.
Roles
A role is a named set of privileges, granted to users and groups. Privileges are never granted directly to a user.
A role holds objects, and for each one a list of privileges, each carrying an ALLOW or DENY
condition. A privilege binds only to object types it supports, so CREATE_TABLE binds to a metalake,
catalog, or schema, never to a table. Whoever creates a role owns it, and can alter or delete it.
A role cannot be deleted while an access control policy names it in its applicable roles. Remove
the role from those policies, or delete them, first. The deletion fails with InUseException
(HTTP 409); in a bulk delete, only that role's item fails. Deleting the metalake removes its roles
and policies together and is not blocked.
Ownership
Ownership can be held by a group as well as a user, in which case every member of that group holds it, and it can be transferred at any time. It applies to metalakes, catalogs, schemas, tables, views, topics, filesets, models, semantic models, functions, domains, roles, tags, policies, job templates, and jobs.
Resolution
Evaluating a Request
Every authorized endpoint declares the conditions under which a caller may invoke it, and the check passes if any one of them holds. Loading a table, for example, succeeds when:
- The caller owns the metalake or the catalog.
- The caller owns the schema and holds
USE_CATALOG. - The caller holds both
USE_CATALOGandUSE_SCHEMA, and additionally owns the table or holdsSELECT_TABLEorMODIFY_TABLE.
Note the third case. Granting SELECT_TABLE on a schema covers every table in that schema, but on
its own it authorizes nothing, because the traversal privileges are still missing.
A failed check returns 403 Forbidden. Some read paths return 404 Not Found instead, so that a
caller cannot infer the existence of an object they are not entitled to see. List operations
normally do not fail; they return only the entries the caller is entitled to see. An object whose
name contains a dot is an exception, as described in Names containing dots.
Allow and Deny
DENY always wins. It beats an ALLOW in the same role, an ALLOW from any other role the user
holds, and an ALLOW at any other level of the hierarchy, in either direction: a DENY on a catalog
survives an ALLOW on its metalake, and a DENY on a metalake survives an ALLOW on its catalog.
So a denial cannot be circumvented by granting something elsewhere.
Sibling privileges are independent of each other. DENY MODIFY_TABLE leaves ALLOW SELECT_TABLE
intact, and the same holds for PRODUCE_TOPIC and CONSUME_TOPIC, and for READ_FILESET and
WRITE_FILESET. To withhold both read and write, deny both.
Privileges and What They Allow
Grantable On lists the object types a privilege can be bound to, and the object it is bound to sets the scope of the grant. Binding a privilege to a type not listed for it is rejected.
Data Object Privileges
| Privilege | Grantable On | What It Allows |
|---|---|---|
CREATE_CATALOG |
Metalake | Create catalogs |
USE_CATALOG |
Metalake, Catalog | Use any catalog in scope, and reach the objects inside it |
CREATE_SCHEMA |
Metalake, Catalog, Schema | Create schemas or nested schemas in scope |
USE_SCHEMA |
Metalake, Catalog, Schema | Use any schema in scope, and reach the objects inside it |
CREATE_TABLE |
Metalake, Catalog, Schema | Create tables in any schema in scope |
PROBE_TABLE_LIKE |
Metalake, Catalog, Schema, Table, View | Probe whether a table-like object exists without reading its data |
SELECT_TABLE |
Metalake, Catalog, Schema, Table | Read any table in scope |
MODIFY_TABLE |
Metalake, Catalog, Schema, Table | Read and write to, and alter the schema of, any table in scope |
CREATE_VIEW |
Metalake, Catalog, Schema | Create views in any schema in scope |
SELECT_VIEW |
Metalake, Catalog, Schema, View | Read view metadata in scope |
CREATE_TOPIC |
Metalake, Catalog, Schema | Create topics in any schema in scope |
CONSUME_TOPIC |
Metalake, Catalog, Schema, Topic | Consume from any topic in scope |
PRODUCE_TOPIC |
Metalake, Catalog, Schema, Topic | Consume from, produce to, and alter any topic in scope |
CREATE_FILESET |
Metalake, Catalog, Schema | Create filesets in any schema in scope |
READ_FILESET |
Metalake, Catalog, Schema, Fileset | Read any fileset in scope |
WRITE_FILESET |
Metalake, Catalog, Schema, Fileset | Read, write, and alter any fileset in scope |
REGISTER_MODEL |
Metalake, Catalog, Schema | Register models in any schema in scope |
LINK_MODEL_VERSION |
Metalake, Catalog, Schema, Model | Link versions to any model in scope |
USE_MODEL |
Metalake, Catalog, Schema, Model | Read the metadata of, and download versions of, any model in scope |
USE_SECRETS |
Metalake, Catalog, Schema, Table, View, Topic, Fileset, Model | Soft-unlock getSecrets (empty map without it, not 403); static credential keys still omitted unless also granted INCLUDE_CREDENTIAL_SECRETS; with INCLUDE_CREDENTIAL_SECRETS, include static providers on catalog/fileset getCredentials |
INCLUDE_CREDENTIAL_SECRETS |
Metalake, Catalog, Schema, Table, View, Topic, Fileset, Model | With USE_SECRETS, include static credential properties in getSecrets and static providers on catalog/fileset getCredentials (token providers need only metadata access; missing privileges soft-filter, not 403) |
REGISTER_FUNCTION |
Metalake, Catalog, Schema | Register functions in any schema in scope |
EXECUTE_FUNCTION |
Metalake, Catalog, Schema, Function | Read the metadata of, and execute, any function in scope |
MODIFY_FUNCTION |
Metalake, Catalog, Schema, Function | Alter or drop any function in scope |
CREATE_SEMANTIC_MODEL |
Metalake, Catalog, Schema | Create semantic models in any schema in scope |
USE_SEMANTIC_MODEL |
Metalake, Catalog, Schema, Semantic Model | Discover and load the definition of any semantic model in scope |
MODIFY_SEMANTIC_MODEL |
Metalake, Catalog, Schema, Semantic Model | Rename, and alter the definition and metadata of, any semantic model in scope |
Either SELECT_TABLE or MODIFY_TABLE is enough to load a table's metadata. Topics and filesets
have similar read/write privilege pairs. Views do not have a modify privilege: SELECT_VIEW reads
view metadata, while altering or dropping a view is owner-only.
CREATE_MODEL and CREATE_MODEL_VERSION are deprecated aliases for REGISTER_MODEL and
LINK_MODEL_VERSION. They resolve to identical authorization, so existing grants keep working, but
they will be removed in a future release. Use the current names in new roles.
Governance and Administrative Privileges
| Privilege | Grantable On | What It Allows |
|---|---|---|
MANAGE_USERS |
Metalake | Add and remove users |
MANAGE_GROUPS |
Metalake | Add and remove groups |
CREATE_ROLE |
Metalake | Create roles |
MANAGE_GRANTS |
Metalake, Catalog, Schema, Table, View, Topic, Fileset, Model, Function, Semantic Model | Grant and revoke privileges on any object in scope |
CREATE_TAG |
Metalake | Create tags |
VIEW_TAG |
Metalake, Tag | Read tag metadata |
APPLY_TAG |
Metalake, Tag | Attach tags to metadata objects |
CREATE_POLICY |
Metalake | Create policies |
VIEW_POLICY |
Metalake, Policy | Read policy metadata |
APPLY_POLICY |
Metalake, Policy | Associate policies with tags |
VIEW_SECRET_PROVIDERS |
Metalake | List configured secrets providers |
REGISTER_JOB_TEMPLATE |
Metalake | Register job templates |
USE_JOB_TEMPLATE |
Metalake, JobTemplate | Run jobs from a job template |
RUN_JOB |
Metalake | Run jobs |
MANAGE_GRANTS bound to a metalake additionally allows granting and revoking roles for users and
groups across that metalake. Bound to anything else it covers privilege management only, on that
object and its descendants.
APPLY_TAG, APPLY_POLICY, and USE_JOB_TEMPLATE scope differently from every other privilege on
this page. The object they bind to is the instrument the holder may use, not the object the operation
acts on. Granting APPLY_POLICY on the policy pii_masking lets the holder associate that
policy with tags, provided they also have APPLY_TAG on each tag. Granting it on the metalake
covers any policy in that metalake.
Assigning a tag to a metadata object requires APPLY_TAG on the tag and access to the object.
For a tag bound to an access-control policy, adding or removing the tag instead requires an explicit
APPLY_TAG grant on that tag and ownership or MANAGE_GRANTS on the object or an ancestor.
Tag ownership or a metalake-level APPLY_TAG grant alone is not sufficient. The metalake owner
can still assign or remove the tag.
Associating a policy with a tag requires access to both: APPLY_POLICY on the policy and
APPLY_TAG on the tag. For descriptive tags and policy association, ownership can satisfy the
corresponding check.
Reading a tag requires VIEW_TAG or APPLY_TAG; reading a policy requires VIEW_POLICY or
APPLY_POLICY. The view privileges do not allow tag assignment or policy-to-tag association.
List results include only tags and policies the caller can read.
Required Privileges
Three rules apply throughout, so they are not repeated below:
- Owning the object, or any ancestor of it, satisfies any check on it. Owner in the tables means ownership is the only route, because no privilege grants that operation.
- Reaching an object inside a catalog and a schema also requires
USE_CATALOGandUSE_SCHEMA. - A privilege counts whether it is held on the object itself or on any ancestor.
List operations first require access to their parent scope. After that gateway check succeeds, they return only the entries the caller is entitled to see, which for a metalake owner is all of them.
Data Objects
| Object | Create | Load | Alter | Drop |
|---|---|---|---|---|
| Catalog | CREATE_CATALOG |
USE_CATALOG |
Owner | Owner |
| Schema | CREATE_SCHEMA |
USE_SCHEMA |
Owner | Owner |
| Table | CREATE_TABLE |
SELECT_TABLE or MODIFY_TABLE |
MODIFY_TABLE |
Owner |
| View | CREATE_VIEW |
SELECT_VIEW |
Owner | Owner |
| Topic | CREATE_TOPIC |
CONSUME_TOPIC or PRODUCE_TOPIC |
PRODUCE_TOPIC |
Owner |
| Fileset | CREATE_FILESET |
READ_FILESET or WRITE_FILESET |
WRITE_FILESET |
Owner |
| Model | REGISTER_MODEL |
USE_MODEL |
Owner | Owner |
| Function | REGISTER_FUNCTION |
EXECUTE_FUNCTION or MODIFY_FUNCTION |
MODIFY_FUNCTION |
Owner |
| Semantic Model | CREATE_SEMANTIC_MODEL |
USE_SEMANTIC_MODEL or MODIFY_SEMANTIC_MODEL |
MODIFY_SEMANTIC_MODEL |
Owner |
Testing a catalog connection follows the catalog row. Testing a catalog before it is created takes
CREATE_CATALOG. Testing an existing catalog with its stored configuration takes USE_CATALOG, the
same as loading it. Testing an existing catalog with proposed changes that are not saved takes
ownership, the same as altering it, because the caller chooses what the server connects to.
Table statistics follow the table itself: reading them takes SELECT_TABLE or MODIFY_TABLE,
writing them takes MODIFY_TABLE. Model versions follow the model: USE_MODEL to read, owner to
alter or delete. Fetching plaintext secrets (getSecrets) requires owning the metalake or holding
USE_SECRETS. Canonical static credential keys on that object (and catalog keys implied by
its effective providers) are included only when the caller is the metalake owner or also holds
INCLUDE_CREDENTIAL_SECRETS. Typos and non-canonical aliases are not treated as static
credential keys for this filter. Catalog and fileset credential vending (getCredentials)
always require metadata access (filesets keep path-based read/write checks). Static providers
also need both USE_SECRETS and INCLUDE_CREDENTIAL_SECRETS, or metalake ownership; token
providers do not. Without those privileges, the response includes only token credentials
(static ones are omitted). Callers who can load the object but lack USE_SECRETS receive an
empty getSecrets result rather than a forbidden error.
The View row applies to metadata operations through both the native Gravitino REST API and the
Iceberg REST Catalog when authorization is enabled. Listing first requires access to the schema and
then filters individual views by ownership or SELECT_VIEW. Creating a view makes the caller its
owner, which is the path used for later alter and drop operations.
These checks authorize View metadata operations only. They do not grant access to referenced tables
or authorize SQL execution. The current Iceberg engine path uses invoker semantics, so the caller
still needs access to the underlying data. The View API has no explicit INVOKER/DEFINER option,
and Gravitino does not implement DEFINER execution or a new engine integration as part of this
authorization behavior.
The native View rename operation changes only the name within the existing schema and remains owner-only; it does not accept a target schema.
Creating or importing a Semantic Model, or replacing its definition, validates every dataset source
as a Table or supported logical View under the
caller's permissions, including cross-catalog references within the request's metalake. Each lookup
requires visibility of that source type before loading metadata. Primary-key, unique-key, and
relationship columns must exist in the resolved source. Source existence and column validation also
run when authorization is disabled. Access denial returns 403, missing sources or columns return
400, and source catalog connection failures return 502. These checks do not authorize queries
against the referenced data or interpret SQL expressions. A missing table in a catalog without View
support is a missing source (400); no unsupported View lookup is attempted.
Metalake Objects
| Object | Create | Read | Alter or delete | Use |
|---|---|---|---|---|
| Metalake | Service administrator | Membership | Owner | |
| User | MANAGE_USERS |
MANAGE_USERS, or the user themselves |
MANAGE_USERS |
|
| Group | MANAGE_GROUPS |
MANAGE_GROUPS, or a member |
MANAGE_GROUPS |
|
| Role | CREATE_ROLE |
MANAGE_GRANTS, or a holder or owner |
Owner | Grant or revoke: MANAGE_GRANTS |
| Tag | CREATE_TAG |
VIEW_TAG or APPLY_TAG |
Owner | Assign: APPLY_TAG and access to the object |
| Policy | CREATE_POLICY |
VIEW_POLICY or APPLY_POLICY |
Owner | Associate with tag: APPLY_POLICY and APPLY_TAG |
| Job template | REGISTER_JOB_TEMPLATE |
USE_JOB_TEMPLATE |
Owner | Run a job: RUN_JOB and USE_JOB_TEMPLATE |
| Job | Owner | Owner | ||
| Secret providers | Owner or VIEW_SECRET_PROVIDERS |
The secrets-provider registry is process-global server configuration; the metalake path only scopes authorization. Listing providers does not return secret material.
Bulk access-control APIs use the same privileges as the matching single-entity operations. Most
bulk operations are authorized once before processing the request. Role removal is authorized per
item because each role can be removed by the metalake owner or by the owner of that role. Bulk
requests report item-level failures in errors.
| API | Required privilege |
|---|---|
POST /api/bulk/metalakes/{metalake}/users/add |
OWNER of the metalake or MANAGE_USERS |
POST /api/bulk/metalakes/{metalake}/users/remove |
OWNER of the metalake or MANAGE_USERS |
POST /api/bulk/metalakes/{metalake}/groups/add |
OWNER of the metalake or MANAGE_GROUPS |
POST /api/bulk/metalakes/{metalake}/groups/remove |
OWNER of the metalake or MANAGE_GROUPS |
POST /api/bulk/metalakes/{metalake}/roles/add |
OWNER of the metalake or CREATE_ROLE |
POST /api/bulk/metalakes/{metalake}/roles/remove |
OWNER of the metalake, or OWNER of the role |
GET /api/metalakes/{metalake}/secrets/providers |
OWNER of the metalake or VIEW_SECRET_PROVIDERS |
For example, add users in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/users/add" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"users": [
{"name": "analyst"},
{"name": "developer", "externalId": "[email protected]", "enabled": true}
]
}'
Remove users in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/users/remove" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"names": ["analyst", "developer"]
}'
For example, add groups in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/groups/add" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"groups": [
{"name": "analysts"},
{"name": "developers", "externalId": "[email protected]"}
]
}'
Remove groups in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/groups/remove" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"names": ["analysts", "developers"]
}'
For example, add roles in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/roles/add" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"roles": [
{"name": "analyst", "properties": {}, "securableObjects": []},
{"name": "developer", "properties": {}, "securableObjects": []}
]
}'
Remove roles in bulk:
curl -X POST "http://localhost:8090/api/bulk/metalakes/{metalake}/roles/remove" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"names": ["analyst", "developer"]
}'
Granting or revoking a privilege on an object takes MANAGE_GRANTS on that object or an ancestor.
Granting or revoking a role, and overriding a role's privileges, takes MANAGE_GRANTS on the
metalake. Setting an owner takes ownership.
Narrowing Access with Active Roles
By default, a request is evaluated against every role the caller holds. The X-Gravitino-Active-Roles
header narrows that set for the request that carries it, so a workload runs with only the roles it
needs instead of every role its user has been granted.
X-Gravitino-Active-Roles: analyst,reader
| Value | Meaning |
|---|---|
analyst |
Activate one named role |
analyst,reader |
Activate several; access is the union of just these |
ALL |
Activate every role the caller holds |
NONE |
Activate no role |
| (absent or empty) | Same as ALL |
Role names are matched exactly, and ALL and NONE are recognized only in upper case, so all is
read as the name of a role. Surrounding whitespace is trimmed and repeated names collapse.
Role Names Outside ASCII
Many HTTP clients cannot send non-ASCII header values: the Apache HttpClient used by Spark, Trino and
the Gravitino Java client replaces such characters with ?. To activate a role whose name contains
non-ASCII characters, a comma, or %, percent-encode the UTF-8 bytes of the name:
X-Gravitino-Active-Roles: vrf_%E8%A7%92%E8%89%B2
This activates the role vrf_角色. Each comma-separated entry is decoded on its own, so a%2Cb
names the single role a,b, and a literal % is sent as %25. + is not decoded as a space, and
whitespace is trimmed before decoding, so an encoded space such as %20 is part of the name. ALL
and NONE are matched before decoding, so %41LL and %4EONE name roles literally called ALL and
NONE.
A client that sends raw UTF-8 bytes, such as curl, can also send the name unencoded, as long as it
contains no , or %. A header value is always read as UTF-8, so bytes in another encoding, such as
ISO-8859-1, are rejected.
What Narrowing Changes
Narrowing only ever subtracts. The server validates the declaration against the roles the caller actually holds, so the header can never widen access, and a caller that omits it is evaluated exactly as before.
DENYstays global. A deny carried by any role the caller holds still applies even when that role is not active, so narrowing cannot be used to escape a denial.- Ownership is untouched. Access that comes from owning an object is granted to the owner
directly rather than through a role, so an owner keeps it even under
NONE. - Every decision in the request is narrowed, not only direct checks. List results are filtered
against the active set, and so are the privileges behind credential vending: an Iceberg caller
whose active roles no longer carry
MODIFY_TABLEis vended a read-only storage credential in place of a writable one.
Errors
| Condition | Response |
|---|---|
An empty entry, such as the trailing comma in analyst, |
400 Bad Request |
ALL or NONE combined with anything else, such as ALL,analyst |
400 Bad Request |
A malformed escape, such as %G1, or a value that is not UTF-8 |
400 Bad Request |
| A name that is blank or has a control character after decoding | 400 Bad Request |
| A well-formed value naming a role the caller does not hold | 403 Forbidden |
A role that does not exist and a role the caller was never granted both return 403, so the response
cannot be used to discover which role names exist. An unheld role is rejected rather than ignored,
which surfaces a typo immediately instead of silently reducing access.
Sending the Header
Apache Spark forwards any header.* catalog property to the Iceberg REST catalog:
spark.sql.catalog.{catalog}.header.X-Gravitino-Active-Roles = analyst
Trino 481 and later forwards headers configured on the catalog:
iceberg.rest-catalog.http-headers = X-Gravitino-Active-Roles: analyst
Both are catalog-level and static, so the same value applies to every user and session using that catalog. The Java client sets the header per client instance:
GravitinoClient.builder(uri)
.withMetalake("metalake")
.withHeaders(ImmutableMap.of("X-Gravitino-Active-Roles", "analyst"))
.build();
Scope
Narrowing applies where Gravitino enforces authorization itself: the native REST API and the Iceberg REST catalog. Catalogs that push enforcement down to an external system evaluate against the mapped user and groups and never see the declaration, so the header has no effect there. See Authorization Pushdown.
Server Configuration
Settings live in ${GRAVITINO_HOME}/conf/gravitino.conf. Authorization is off by default; the
Quick Start shows the two settings that turn it on.
| Setting * | Description | Default |
|---|---|---|
enable |
Enable or disable authorization | false |
serviceAdmins |
Comma-separated service administrator usernames. Required when enable is true |
(none) |
impl |
Metadata authorization implementation | † |
threadPoolSize |
Thread pool size for metadata authorization requests | 10 |
jcasbin.cacheExpirationSecs |
How long a cache entry stays valid. Lowering it reduces staleness and increases backend reads | 3600 |
jcasbin.roleCacheSize |
Maximum size of each role-related cache. Applied to three caches, so real memory use is about 3x this value | 10000 |
jcasbin.ownerCacheSize |
Maximum size of the owner cache | 100000 |
jcasbin.metadataIdCacheSize |
Maximum size of the metadata name-to-ID cache | 100000 |
jcasbin.changePollIntervalSecs |
How often the server polls for entity and owner changes to invalidate its caches. Must be greater than zero | 3 |
* Setting names omit the leading gravitino.authorization. prefix. Write it out in full in the
configuration file:
gravitino.authorization.jcasbin.roleCacheSize = 10000
† The default is org.apache.gravitino.server.authorization.jcasbin.JcasbinAuthorizer.
Setting gravitino.authorization.impl to
org.apache.gravitino.server.authorization.PassThroughAuthorizer runs the server with authorization
enabled but every check bypassed. Pass-through mode exists for migration and is not intended for
production. See Enabling Authorization on Existing Metalakes.
The default authorizer keeps role and ownership information in Caffeine caches, so most authorization
decisions need no backend read. When privileges or ownership change through the Gravitino API, the
server handling the change invalidates the affected entries immediately. Other nodes in a multi-node
deployment pick the change up on their next poll, so a revocation can take up to
jcasbin.changePollIntervalSecs to take effect across the cluster. Lower the interval if that window
is unacceptable for your environment.
Authentication
Authorization decides what a caller may do; authentication establishes who the caller is.
gravitino.authenticators selects the mechanism, and defaults to simple, which reads an
unvalidated HTTP Basic header and suits local evaluation only. For OAuth:
gravitino.authenticators = oauth
gravitino.authenticator.oauth.jwksUri = {jwks_uri}
gravitino.authenticator.oauth.serviceAudience = {audience}
# The JWT claims that become the Gravitino user name and group memberships
gravitino.authenticator.oauth.principalFields = preferred_username
gravitino.authenticator.oauth.groupsFields = groups
Two of those settings connect a token to this page:
principalFieldsnames the JWT claim whose value becomes the Gravitino user name, so it must produce the same strings you add to metalakes and grant roles to. It defaults tosub, which is usually an opaque provider ID rather than a name anyone would type.groupsFieldsnames the claim supplying group membership, which is how a role granted to a group reaches a user.
See How to Authenticate for Kerberos and the other options.
Behavior Notes
- Add users to a metalake before creating metadata objects in it.
- If a request carries no user identity, the operation runs as the
anonymoususer. - When authorization is enabled, the creator of a metalake is automatically added to it as a user.
Enabling Authorization on Existing Metalakes
Metalakes created while gravitino.authorization.enable was false have no owner. Once full
authorization is enabled, operations on an ownerless metalake fail, so assign owners first.
Step 1. Enable authorization in pass-through mode, which turns on the authorization machinery while bypassing the checks:
# Turn authorization on, but bypass every check while you assign owners
gravitino.authorization.enable = true
gravitino.authorization.serviceAdmins = {admin_user_1},{admin_user_2}
gravitino.authorization.impl = org.apache.gravitino.server.authorization.PassThroughAuthorizer
Restart the server.
Step 2. Set an owner for each existing metalake.
curl -X PUT \
"$GRAVITINO/owners/metalake/{metalake}" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"name": "{admin_user_1}",
"type": "USER"
}'
Step 3. Remove the gravitino.authorization.impl line so that the default authorizer takes over:
# The same settings with the pass-through line gone, so checks now apply
gravitino.authorization.enable = true
gravitino.authorization.serviceAdmins = {admin_user_1},{admin_user_2}
Step 4. Restart the server.
Confirm that every metalake has an owner before completing step 3. Any metalake left without one becomes unusable when full authorization takes effect.
Walkthrough
Three identities act in turn, from an empty server to a user reading one schema. The service
administrator bootstraps the metalake and hands it off, manager runs it, and staff builds and
shares the data. Each presents its own bearer token.
Every call sends the same two headers, so the examples use a helper:
GRAVITINO=http://localhost:8090/api/metalakes/{metalake}
gravitino() {
curl -sS -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" "$@"
}
1. The service administrator creates the metalake and hands it over. Creating it adds the creator
as a user and makes them owner, which is what authorizes the next two calls. After the transfer,
manager owns the metalake and the service administrator has no further part to play.
gravitino -X POST "http://localhost:8090/api/metalakes" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-d '{"name": "{metalake}", "comment": "example metalake", "properties": {}}'
gravitino -X POST "$GRAVITINO/users" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-d '{"name": "manager"}'
gravitino -X PUT "$GRAVITINO/owners/metalake/{metalake}" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-d '{"name": "manager", "type": "USER"}'
2. manager delegates catalog creation to staff. Owning the metalake lets manager add users
and create roles without any grant. The role carries CREATE_CATALOG on the metalake, so it covers
every catalog staff creates, now and later.
gravitino -X POST "$GRAVITINO/users" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-d '{"name": "staff"}'
gravitino -X POST "$GRAVITINO/roles" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-d '{
"name": "catalog_manager",
"properties": {},
"securableObjects": [
{
"fullName": "{metalake}",
"type": "METALAKE",
"privileges": [{"name": "CREATE_CATALOG", "condition": "ALLOW"}]
}
]
}'
gravitino -X PUT "$GRAVITINO/permissions/users/staff/grant" \
-H "Authorization: Bearer $MANAGER_TOKEN" \
-d '{"roleNames": ["catalog_manager"]}'
3. staff builds out the data. Creating the catalog makes staff its owner, and that ownership
carries everything inside it, so the schema needs no further grant. The example uses Hive; any
provider works, with its own properties.
gravitino -X POST "$GRAVITINO/catalogs" \
-H "Authorization: Bearer $STAFF_TOKEN" \
-d '{
"name": "{catalog}",
"type": "RELATIONAL",
"provider": "hive",
"properties": {"metastore.uris": "thrift://{hive_host}:9083"}
}'
gravitino -X POST "$GRAVITINO/catalogs/{catalog}/schemas" \
-H "Authorization: Bearer $STAFF_TOKEN" \
-d '{"name": "{schema}"}'
4. staff gives analyst read access. Reading one schema takes three privileges: USE_CATALOG
and USE_SCHEMA to reach it, and SELECT_TABLE to read what is in it. Object names are not
validated, so a typo produces a role that grants nothing. analyst must already be a user in the
metalake.
gravitino -X POST "$GRAVITINO/roles" \
-H "Authorization: Bearer $STAFF_TOKEN" \
-d '{
"name": "schema_reader",
"properties": {},
"securableObjects": [
{
"fullName": "{catalog}",
"type": "CATALOG",
"privileges": [{"name": "USE_CATALOG", "condition": "ALLOW"}]
},
{
"fullName": "{catalog}.{schema}",
"type": "SCHEMA",
"privileges": [
{"name": "USE_SCHEMA", "condition": "ALLOW"},
{"name": "SELECT_TABLE", "condition": "ALLOW"}
]
}
]
}'
gravitino -X PUT "$GRAVITINO/permissions/users/analyst/grant" \
-H "Authorization: Bearer $STAFF_TOKEN" \
-d '{"roleNames": ["schema_reader"]}'
analyst can now read every table in {catalog}.{schema}, including tables created there later, and
can do nothing anywhere else in the metalake. Queries through the Gravitino connector are authorized
against the same ownership and privileges that governed the metadata calls above.
Endpoints
Paths are relative to http://localhost:8090/api/metalakes/{metalake}. For request and response
schemas, see the Gravitino REST API.
Users, groups, and roles share one shape. Substitute users, groups, or roles for
{collection}, and the user, group, or role name for {name}:
| Operation | Method | Path |
|---|---|---|
| Create | POST |
/{collection} |
| List | GET |
/{collection} |
| Get | GET |
/{collection}/{name} |
| Delete | DELETE |
/{collection}/{name} |
Add ?details=true to a list path to get full objects instead of names.
The rest are one of a kind:
| Operation | Method | Path |
|---|---|---|
| Grant privileges to a role | PUT |
/permissions/roles/{role}/{object_type}/{object_name}/grant |
| Revoke privileges from a role | PUT |
/permissions/roles/{role}/{object_type}/{object_name}/revoke |
| Replace a role's privileges | PUT |
/permissions/roles/{role}/ |
| Grant roles to a user or group | PUT |
/permissions/{collection}/{name}/grant |
| Revoke roles from a user or group | PUT |
/permissions/{collection}/{name}/revoke |
| List the roles bound to an object | GET |
/objects/{object_type}/{object_name}/roles |
| Get or set an object's owner | GET, PUT |
/owners/{object_type}/{object_name} |
Replacing a role's privileges is destructive: afterwards the role holds exactly what the request body contains, and any object absent from it is dropped.
Java Client
Most calls map directly onto a GravitinoClient method and are covered by the
Java doc.
Three take arguments that are hard to derive from the signature alone.
A role's objects are built as a nested path rather than a dotted string:
SecurableObject table =
SecurableObjects.ofTable(
SecurableObjects.ofSchema(
SecurableObjects.ofCatalog("catalog1", Collections.emptyList()),
"schema1",
Collections.emptyList()),
"table1",
Lists.newArrayList(Privileges.SelectTable.allow()));
Role role = client.createRole("schema_reader", ImmutableMap.of(), Lists.newArrayList(table));
Privileges are passed as a Set, and each carries its condition. The List overloads of these two
methods are deprecated:
MetadataObject schema =
MetadataObjects.of(Lists.newArrayList("catalog1", "schema1"), MetadataObject.Type.SCHEMA);
client.grantPrivilegesToRole("schema_reader", schema, ImmutableSet.of(Privileges.SelectTable.allow()));
client.revokePrivilegesFromRole("schema_reader", schema, ImmutableSet.of(Privileges.SelectTable.deny()));
An owner is set with an Owner.Type, not a string:
client.setOwner(schema, "analyst", Owner.Type.USER);
Related
- Gravitino REST API, for the request and response schemas of every user, group, role, permission, and owner endpoint
- Java Client and Python Client, for calling those endpoints from a client library
org.apache.gravitino.authorization, the Java classes behind this page:Privilege,Privileges,SecurableObject, andOwner- Authorization Pushdown, for pushing enforcement down to the underlying data source or to an external system such as Apache Ranger
- How to Authenticate, for establishing who the caller is
- Local users and groups
Domain permissions
Domains have two privileges, bindable to a metalake or a domain:
| Privilege | Operations |
|---|---|
USE_DOMAIN |
Read published domains, list their visible subdomains and accessible members, and discover them from accessible leaf metadata. |
MANAGE_DOMAIN |
Create, alter, delete, publish/unpublish, change parent and change backing tag; also use domains and see drafts. |
A top-level domain is created with MANAGE_DOMAIN on the metalake. Creating a subdomain requires
management on both the metalake and parent. Attaching/moving requires management on the child
(using its current scopes) and the new parent. Other mutations require management on the domain.
Privileges are evaluated over the metalake, current parent (if any), and domain. An allow on any
scope suffices only when no scope denies that privilege. An explicit USE_DOMAIN deny prevents
use even with an allowed MANAGE_DOMAIN. Owners of the domain, current parent or metalake bypass
these privilege denies. Service administrators retain administrative access.
A draft is omitted from lists for callers who cannot manage it; direct access returns
NoSuchDomainException (404). A published domain without use permission is omitted from lists,
but direct access returns ForbiddenException (403). A child snapshot can still name a hidden
draft parent; this does not authorize loading the parent. Moving/detaching changes the inherited
scopes immediately, without rewriting grants: former parent permissions stop applying.
Domain visibility and data visibility are separate. Member lists filter out leaf objects the caller
cannot access under ordinary metadata authorization. Reverse lookup of an inaccessible object
returns 403. USE_DOMAIN and MANAGE_DOMAIN do not grant catalog/schema use, table selection,
fileset access, model access or any backend data permission. A hidden child contributes no
VIA_SUBDOMAIN relation, in either query direction. Relations with no visible membership path
are removed. An INHERITED relation for an accessible leaf retains the complete source catalog or
schema name; the source is explanatory metadata and is not separately authorized by this query.
Tag privileges are also separate. Creating a new backing tag requires CREATE_TAG on the metalake
in addition to Domain management. Binding an existing tag requires ownership of that tag or the
metalake; Domain ownership alone does not confer tag ownership. Removing a binding requires no tag
privilege. Assigning/removing tags on member metadata uses the existing tag authorization rules;
Domain management does not confer assignment rights. Reading Domain membership does not require
VIEW_TAG, APPLY_TAG or tag ownership.
For example, after creating user domain_reader, grant a role over a published Finance domain:
curl --fail-with-body -u anonymous:dummy -H 'Content-Type: application/json' \
-d '{"name":"finance_reader","properties":{},"securableObjects":[{"fullName":"Finance","type":"domain","privileges":[{"name":"USE_DOMAIN","condition":"ALLOW"}]}]}' \
http://127.0.0.1:8090/api/metalakes/test/roles
curl --fail-with-body -u anonymous:dummy -X PUT -H 'Content-Type: application/json' \
-d '{"roleNames":["finance_reader"]}' \
http://127.0.0.1:8090/api/metalakes/test/permissions/users/domain_reader/grant
Use the role/user APIs from the walkthrough above to create the user first. This role permits
published Finance discovery and inherited use of its published children, but a member list can
still be empty until the user has ordinary access to member objects. Replacing USE_DOMAIN with
MANAGE_DOMAIN grants management and draft visibility. A child USE_DOMAIN deny can exclude that
child from the reader's inherited access. See the Domain guide
for executable SDK examples, lifecycle constraints, tag rules and REST errors.