markhoerth opened a new issue, #14468:
URL: https://github.com/apache/gravitino/issues/14468
### Version
main branch
### Describe what's wrong
1. Namespaces, tables and views created through the Iceberg REST catalog
have an empty `audit` in the Gravitino API, with no `creator` or `createTime`.
The hooks import the object by loading it, and the Iceberg catalog reports
`AuditInfo.EMPTY`.
2. After a schema change committed through the IRC, the table's
`lastModifier` is `anonymous`. The stored columns are only brought up to date
by the next load (`TableOperationDispatcher.updateColumnsIfNecessaryWhenLoad`),
which records the loading principal. When the first load is an async event
listener with no `Subject`, that principal is anonymous.
3. A request the IRC refuses for lack of privileges is audited as `UNKNOWN`
with a null object. `BaseMetadataAuthorizationMethodInterceptor` throws
`ForbiddenException` without dispatching `AuthorizationDenialFailureEvent`, so
only the `HttpAuditFilter` fallback is written. The same denial through the
Gravitino API is audited as `AUTHORIZATION_DENIAL` with the object and
expression.
4. `POST .../tables/{table}/metrics` is audited as `TABLE_EXISTS`, because
`reportTableMetrics` checks the table through the event dispatcher's
`tableExists`, and the report itself dispatches no event.
### Error message and/or stacktrace
```
GET /api/metalakes/m/catalogs/c/schemas/ns/tables/t "audit": {}
(created through IRC)
GET /api/metalakes/m/catalogs/c/schemas/ns/tables/t "lastModifier":
"anonymous" (after an IRC add-column)
audit: reader UNKNOWN null FAILURE
GRAVITINO_ICEBERG_REST_SERVER {http.status=403}
audit: admin TABLE_EXISTS m.c.ns.t SUCCESS
GRAVITINO_ICEBERG_REST_SERVER (POST .../metrics)
```
### How to reproduce
1. Create a namespace, table and view through the IRC and load them through
the Gravitino API.
2. With an async event listener enabled, add a column through an IRC commit
and load the table after a few seconds.
3. With the audit log enabled, load a table through the IRC as a user with
no privilege on it.
4. Post a commit report to the table's metrics route and read the audit log.
### Additional context
Expected: the IRC user is recorded as creator and modifier, a denial is
audited like a Gravitino API denial, and a metrics report is audited as its own
operation.
--
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]