laserninja opened a new issue, #14922:
URL: https://github.com/apache/gravitino/issues/14922
### Describe the feature
Let users and administrators find out why an authorization decision was
made, who holds access to
an object, and what happened to it, without reading server logs:
- **Explain**: for one principal, operation (or privilege) and object,
return the decision with a
trace of every check and the roles that granted or denied each one.
- **Access review**: for one object and privilege, list the roles that grant
or deny it on the
object or any ancestor, the users and groups holding those roles, and the
owners along the chain.
- **Queryable audit**: optionally persist audit events in the relational
store and query them by
user, object, operation type, outcome, source and time.
### Motivation
A denied request returns a `403` whose message echoes the endpoint's raw
authorization
expression. The message does not say which check failed, whether a `DENY`
fired, or which role it
came from. The only diagnosis is a `DEBUG` log on the node that served the
request.
`GET /objects/{type}/{fullName}/roles` lists role names bound to a single
object. It does not
cover grants inherited from the catalog or schema, or name the users behind
the roles.
Audit events go to one writer, a local file by default. A multi-node
deployment has one file per
node, and nothing can filter events by metalake, object or outcome.
### Describe the solution
- `POST /api/metalakes/{metalake}/authorization/explain`. It re-evaluates
the endpoint's own
parsed expression without short-circuiting, through a recording
authorizer, so explain and
enforcement cannot drift. A test asserts they agree for every registered
expression.
- `GET
/api/metalakes/{metalake}/objects/{type}/{fullName}/access?privilege=...`,
gated by the
same check as granting on the object.
- An `audit_event` table, written by a separate async listener behind
`gravitino.audit.store.enabled` (off by default), with retention.
- `GET /api/metalakes/{metalake}/audit/events`, readable by the metalake
owner and a new
`VIEW_AUDIT` privilege.
- Self-service: any metalake user can explain their own requests and read
their own audit events.
- A response header on `403` naming the operation, so a denial can be passed
straight to explain.
- Java client, Python client, CLI and MCP support.
A design document will follow in a PR.
### Additional context
- Not covered by the authorization hardening epic #14245, which is bug fixes
only.
- Tag-based access control (#12758) will add a new source of grants that
explain must report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]