Repository navigation
[Server] Audit records for permission changes - #2029
Conversation
906f37b to
c2e9e42
Compare
c2e9e42 to
0edf385
Compare
f22b906 to
1c07f72
Compare
|
/review |
1c07f72 to
b4ccca6
Compare
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2059/files) to review incremental changes. - [**stack/uc-jvm-shutdown**](#2059) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2059/files)] ← _this PR_ - [uc-audit-records](#2028) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2028/files/4db7e939a4129e4ae46752bff44a5e628a20e44e..6ad246f2cb7a16489d89c910e2ec111c32848222)] - [stack/uc-audit-permissions](#2029) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2029/files/6ad246f2cb7a16489d89c910e2ec111c32848222..b4ccca6f0196d58cbf94d102ccfce35ffef018d7)] - [stack/uc-audit-cleanup-join](#2030) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2030/files/b4ccca6f0196d58cbf94d102ccfce35ffef018d7..e6e03d5c059544262cb0f79ff118fae34fc83e49)] --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [x] If there is a related issue, make sure it is linked to this PR. - [ ] If you've fixed a bug or added code that should be tested, add tests! - [x] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** On SIGTERM (`docker stop`, or Kubernetes stopping a pod), the server doesn't shut down cleanly. In the Docker image the JVM never even receives the signal: `bin/start-uc-server` runs `java` as a child of the shell, so `docker stop` waits 10s and kills it. This PR: - `exec`s the JVM from `bin/start-uc-server`, so it receives SIGTERM; - on SIGTERM, runs the server's `close()` from Armeria's shutdown hook: it stops the storage cleanup, lets in-flight requests finish for up to `server.shutdown-timeout`, and closes the rest of the server (blocking executor, authorizer, Hikari pool). Log4j stops last; - turns off Log4j's own JVM hook on that `java` command line, so lines logged during the drain are kept; - changes the default H2 URLs (`etc/conf/hibernate.properties` and the Helm chart) from `DB_CLOSE_DELAY=-1` to `DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=0`, so H2's own JVM hook doesn't close the database while requests drain, and the database closes when the server closes its pool. `docs/server/configuration.md` now documents `server.shutdown-timeout`, and `docs/server/deployment.md` the H2 setting. **Compatibility:** after SIGTERM the process can take up to `server.shutdown-timeout` (default 5s) to drain requests, plus up to 5s if a storage cleanup attempt is running, plus about 2s for Armeria's final stop. With the default, give `docker stop` 15s or more, and raise it and `terminationGracePeriodSeconds` when you raise `server.shutdown-timeout`. <details><summary><b>📐 Design notes & details</b></summary> **Before and after, on the Docker image:** | | Before | After | |---|---|---| | PID 1 | `start-uc-server` (bash), with `java` as a child | `java` | | `docker stop` | 10s, then SIGKILL (exit 137) | about 3s, exit 143 | | `server.log` at shutdown | nothing | `Unity Catalog server stopped.`, then Hikari's `Shutdown completed.` | Kafka (`bin/kafka-run-class.sh`), Pulsar (`bin/pulsar`), Elasticsearch (its Docker entrypoint) and Polaris (`run-java.sh`) also `exec` the JVM. **Order on SIGTERM.** Everything runs on Armeria's hook thread, so it finishes before the JVM exits. 1. `closeOnJvmShutdown(unityCatalogServer::close)` runs `close()` as its `whenClosing` step. `close()` stops the cleanup worker, drains requests through `server.stop()`, then drains the blocking executor with the time left and closes the other resources. SIGTERM and `close()` share one shutdown path. 2. Armeria's own `server.close()` then finds the server stopped and returns at once. 3. Log4j stops last, through `whenComplete`, so it stops even if `close()` fails. Armeria logs that failure. **Policy refresh.** With policy refresh on, `close()` interrupts a refresh still running instead of waiting for it: a refresh holds the refresher's lock while it reads the database, and `close()` used to need that lock first, so a refresh stuck in JDBC blocked shutdown. **Leftover requests.** If requests are still running when the drain's time is up, `close()` interrupts them and waits up to 500 ms for them to stop before it closes the resources they use. One that ignores the interrupt keeps running until the process exits. **Failures.** A resource that fails to close is logged and the rest still close. The database pool now closes the same way in `close()`; before, a failure there replaced an earlier failure from `stop()`. If the server fails to start, `main` closes it and then stops Log4j, since the script turns Log4j's own hook off. **Startup window.** The hook is registered after `start()`, so `close()` can't run during a start. A SIGTERM while the server is starting exits without it, as before this PR. **Why Log4j's hook is off.** JVM shutdown hooks run concurrently, and Log4j's own hook stopped logging while Armeria was still draining. The flag is on the `java` line, as Pulsar does it and as Elasticsearch's launcher adds it, so only the server started by the script is affected; the CLI, tests and apps that embed the server keep Log4j's hook. Running the server another way (`java -jar`, `sbt server/run`) still drains on SIGTERM, but may lose the lines logged during the drain, as before. Log4j's config-file switch (`shutdownHook = disable`) doesn't work here. Log4j starts with its default config when `UnityCatalogServer` loads, and registers its hook then. The server applies `etc/conf/server.log4j2.properties` later. **Why H2 keeps the database open.** H2 closes a file database from its own JVM hook as soon as the JVM starts to exit, so a request still draining fails when it touches the database ("Database is already closed"). With `DB_CLOSE_ON_EXIT=FALSE`, it stays open during the drain. `DB_CLOSE_DELAY=0` closes the database when `close()` closes the pool. It must be in the URL, not just `-1` removed: H2 stores the delay in the database file, so a database first opened with `-1`, including the shipped `etc/db/h2db`, keeps it and would never close. **Tests.** No automated test: a JVM hook only runs when the process exits, and the CI jobs that start the server through the script or the image are disabled. A forked-JVM test is tracked in #2064. This was checked by hand: - **locally through `bin/start-uc-server`, 3 runs:** the script's PID is `java`; after SIGTERM the process exits with 143 in about 2.4s and `server.log` has `Unity Catalog server stopped.`, which `close()` logs after the drain, and Hikari's `Shutdown completed.` from its last step. Started with plain `java` (no flag), both lines were missing in 2 of 2 runs; - **H2** (2.2.224): a query from a JVM shutdown hook fails with the old URL and succeeds with `DB_CLOSE_ON_EXIT=FALSE`. A database created with `DB_CLOSE_DELAY=-1` (as the shipped sample was) and reopened without it still reports `-1` and stays open after its last connection closes; reopened with `DB_CLOSE_DELAY=0`, it closes, and a second process can open it. A catalog created before SIGTERM is still there after a restart; - **on an image built from this branch:** the table above; - **start failure:** with port 8080 already taken, the process exits with 1, logs the bind error, and closes the database pool before Log4j stops. `UnityCatalogServerTest` and `UnityCatalogServerShutdownTest` pass. </details> This pull request and its description were written by Isaac. --------- Signed-off-by: Shubham Bansal <[email protected]> Co-authored-by: Isaac <[email protected]>
Adds opt-in audit records. With server.audit.sink set, the server writes one record per issued storage credential: to the caller (CLIENT), for its own use in a request (SERVER), or for the background storage cleanup (CLEANUP, user system:storage-cleanup, with the dropped object's ID). Cache hits count. FileAuditSink writes JSON lines to etc/logs/audit.log; a custom AuditSink can send them elsewhere. Records hold no secrets. Sink failures at runtime are logged and never fail a request; a misconfigured sink fails startup. StorageCredentialVendor becomes an interface (code in StorageCredentialVendorImpl) so the audit decorator wraps it; FileOperationsImpl passes the SERVER or CLEANUP purpose. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Merge the class-not-found, wrong-type and no-constructor branches into one message. Keep the constructor-failure branch, so FileAuditSink's Log4j fix-it message stays on the first line. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
AuditorTest already checks that an unset server.audit.sink yields no auditor. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…iles A mocked Logger checks that record() logs each record's JSON at INFO, and a check on the parsed shipped Log4j config pins the audit logger to its own AuditFile appender, writing etc/logs/audit.log with the %m%n layout. Logging at debug, adding a timestamp to the layout, or pointing the audit logger at another appender each fails a test. FileAuditSink gets a package-private constructor that takes the Logger. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… starts it Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…sions Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Signed-off-by: Shubham Bansal <[email protected]> # Conflicts: # docs/server/configuration.md # etc/conf/server.properties # helm/README.md # helm/README.md.gotmpl # server/src/test/java/io/unitycatalog/server/audit/AuditPermissionIntegrationTest.java # server/src/test/java/io/unitycatalog/server/audit/AuditorTest.java
SdkTableAccessControlCRUDTest checks QUEUE_CLEANUP through the server, and the cleanup tests check each drop's record against its task. The test keeps its unitycatalog#2029 name and scope. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Signed-off-by: Shubham Bansal <[email protected]> # Conflicts: # server/src/test/java/io/unitycatalog/server/audit/AuditorTest.java
…dit-cleanup-join Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
|
/review |
…hat was asked for, and the INFO rule Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…sions Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… vends Iceberg returned an empty config for file: tables before reaching the vendor, so those loads wrote no audit record, while the same access through the temporary-credentials endpoints or the Delta API did. getFileIOConfig now calls the vendor for local paths too and still returns an empty config. The vendor returns empty credentials for local paths before the external-location lookup, whose result it ignored for them, so no caller pays for that lookup. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…sions Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
## 🥞 Stacked PR - [**uc-audit-records**](#2028) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2028/files)] ← _this PR_ - [stack/uc-audit-permissions](#2029) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2029/files/cf57b065909bab74d0e7596a5256eb3c88a09d5d..fad9e62d824956a3fb14385636d2e3816f230892)] - [stack/uc-audit-cleanup-join](#2030) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2030/files/fad9e62d824956a3fb14385636d2e3816f230892..295bf3803ac83ff7861e50cabc0f2a2d4f26ed52)] --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [x] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** Operators can't tell today who received storage credentials. With `server.audit.sink` set, the server writes one audit record per issued storage credential: for the caller (`CLIENT`), for its own use in a request (`SERVER`), or for the background cleanup (`CLEANUP`). Cache hits are included. Records never contain secrets. The built-in `FileAuditSink` writes JSON lines to `etc/logs/audit.log`; a custom `AuditSink` class can send them elsewhere. Unset (the default), nothing changes. ```json {"time":"2026-10-20T10:02:00.000Z","action":"ISSUE_CREDENTIAL","user":"[email protected]","request_id":"…","purpose":"CLIENT","location":"s3://bucket/root/tables/7f3a…","access":"READ","expires_at":"2026-10-20T11:02:00.000Z"} ``` **Open for discussion:** should audit be on by default? This PR keeps it off. **Compatibility:** `StorageCredentialVendor` is now an interface; `new StorageCredentialVendor(...)` becomes `new StorageCredentialVendorImpl(...)`, and `vendCredential(path, privileges)` becomes `vendCredential(path, privileges, CredentialUse)`. Code compiled against the old class fails to link (`IncompatibleClassChangeError`), so embedders must rebuild against this release. `FileOperations.getCleanupFileIO` also takes the dropped object's ID now (`getCleanupFileIO(rootPath, resourceId, deadline)`), so a `FileOperations` implementation or `fileOperationsDecorator` must add the parameter and pass it through. <details><summary><b>📐 Design notes & details</b></summary> **Stack.** - This builds on #2059 (merged), which closes the server on SIGTERM. - #2029 adds permission changes on top of this. - #2030 then links a drop to its storage cleanup. **Where records are made.** `StorageCredentialVendor` is split into an interface and `StorageCredentialVendorImpl`, as with `FileOperations`/`FileOperationsImpl`. When the sink is set, an audit decorator wraps the vendor before `FileOperationsImpl` gets it. So it sits above the credential cache and sees every credential. **Purpose.** - `vendCredential` takes a `CredentialUse`, which has only three values: `CredentialUse.CLIENT`, `CredentialUse.SERVER`, and `CredentialUse.cleanup(id)` for the dropped object's ID. So a purpose and a resource ID cannot disagree, and there is no default. - `FileOperationsImpl.getFileIO` passes `SERVER`, and `getCleanupFileIO` passes `cleanup(id)`. Every other caller is a client-facing service and passes `CLIENT`. - Local `file:` paths have no credential, but a client's request is still recorded, without `expires_at`, through every API. Iceberg's `getFileIOConfig` used to return before the vendor for them; it now calls the vendor and still returns an empty config. The vendor returns empty credentials for local paths before the external-location lookup, whose result it ignored for them anyway. The server's own local reads, writes and cleanup are not recorded. - A cleanup record's user is `system:storage-cleanup`. - Its `resource_id` is the dropped object's ID, which the cleanup worker passes to the credential vend. **No secrets.** `location` keeps scheme, authority and path, and drops the query, the fragment and user info. ABFS keeps `container@account` when the part before the `@` looks like a container name (3 to 63 lowercase letters, digits and hyphens), and writes `[REDACTED]` in its place otherwise. **Failures.** Anything a sink throws is caught, and the request continues. Failures are logged at ERROR in `server.log` at most once a minute, with a count. A location that can't be parsed is logged at WARN, and the record is written without that field. At startup, the server fails if the sink class can't be loaded. It also fails if `FileAuditSink`'s `audit` logger: - is missing, or has no appender; - is additive; - doesn't enable INFO; - has a file or console appender that ignores exceptions or has a filter. Other appenders, for example one that ships records to a cloud service, are not checked. That keeps audit lines out of `server.log`. **Lifecycle.** - `UnityCatalogServer.close()` closes the sink once. - SIGTERM runs `close()` (#2059), so the sink closes after the drain and before Log4j stops, and drained requests' records are written. **Log file.** - The `audit` appender in `etc/conf/server.log4j2.properties` mirrors `server.log`'s rollover. The Helm template rolls `audit.log` the same way; there, `server.log` goes to the console. - `createOnDemand` means no file appears while audit is off. - `server.log` is unchanged. - Archives follow `server.log`'s policy: hourly, kept for up to 7 days or 1GB. The docs still say to ship `audit.log` continuously, since a busy server cannot hold every record on disk for long. **Helm.** No new values. Turn audit on with `server.config.extraProperties`, and ship the file with a sidecar that shares the log directory. **Plugin compatibility.** - `AuditRecord` is a final class with a builder, not a Java record, so adding fields doesn't break compiled sinks. - `time` and `action` are always set. - New `AuditSink` methods are `default` only. - `access` and `purpose` are the record's own `Access` and `Purpose` enums (`CredentialUse` uses `AuditRecord.Purpose`), so the public record depends on neither generated API types nor server-internal packages. **Tests.** - `AuditorTest`: the cleanup record and its exact JSON, vended through the decorator together with a plain client vend (recorded as `CLIENT` with `READ` access), location stripping (including ABFS), sink failures, startup checks, and decorators forwarding default methods. - `AuditCredentialVendingIntegrationTest`: an s3 catalog with authorization off, a request ID on every record, plus server close. - Purpose checks in `FileOperationsTest`. The integration test can't see `SERVER`/`CLEANUP`, because its test-only `LocalMappingFileOperations` serves those calls itself. </details> This pull request and its description were written by Isaac. --------- Signed-off-by: Shubham Bansal <[email protected]> Co-authored-by: Isaac <[email protected]>
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] No blockers. I verified the two claims this PR rests on: jCasbin 1.99.0 calls the adapter before the model on removePolicy/removeFilteredPolicy (and the model first on addPolicy), so the grant-vs-revoke recording rule is right for multi-server setups; and jdbc-adapter 2.13.0 calls ExecutionContext.getLastFailure while every Failsafe method iceberg-aws 1.11.0 references (all in S3InputStream) exists in 3.2.3. The pin reaches the shaded jar and the tarball. A few small comments inline.
- Check the revoke records carry the catalog's ID, not just any ID. - Say why the audited table is managed: its drop also queues the storage cleanup. - Note that the Failsafe pin applies to the server project only. - Start the permission paragraph of the audit docs on its own line. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…dit-cleanup-join Signed-off-by: Shubham Bansal <[email protected]>
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] LGTM, thanks for addressing the comments. One optional, non-blocking test suggestion inline. The red All tests (Spark 4.0.0, Delta 4.4.1) check is SdkModelCRUDTest.testModelCRUD seeing updatedAt == createdAt in the same millisecond, which is unrelated to this PR; a rerun should clear it.
| } | ||
|
|
||
| @Override | ||
| public boolean clearAuthorizationsForPrincipal(UUID principal) { |
There was a problem hiding this comment.
[AI Assisted] Not a blocker, the behavior is right today. Only revoke is tested with a false return (the second revoke in the SDK test). Both clears return true in the tests, so wrapping either emission in if (changed) would still pass and silently drop records on a server with a stale policy. Can we pin it with a small AuditorTest case: a mock whose four mutators return false, asserting the grant records nothing, revoke and both clears each record one, and false is still returned?
…2030) ## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2030/files/9c3a95bbdbbdd9933e3619a6c4710eb9475b22fe..978a53b5390cbe04aaee3e50564f4dbd732b3744) to review incremental changes. - [uc-audit-records](#2028) (merged) - [stack/uc-audit-permissions](#2029) (merged) - [**stack/uc-audit-cleanup-join**](#2030) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2030/files/9c3a95bbdbbdd9933e3619a6c4710eb9475b22fe..978a53b5390cbe04aaee3e50564f4dbd732b3744)] ← _this PR_ --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [x] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** Builds on #2029. Cleanup credentials are recorded as `system:storage-cleanup`, so they don't say who dropped the object. This PR records `QUEUE_CLEANUP` with the dropping user when a drop queues storage cleanup. Its `resource_id` matches the cleanup's credential records. It is written only after the drop commits. **Compatibility:** `Repositories.getStorageCleanupTaskRepository()` now returns the new `CleanupTaskRepository` interface, and its `Claim` and `CleanupFailureReport` records moved there from `StorageCleanupTaskRepository`. Rebuild against this release: the nested class names, the getter's return type and the `StorageCleanupWorker` constructor changed. Use `CleanupTaskRepository.Claim` and `CleanupTaskRepository.CleanupFailureReport`. <details><summary><b>📐 Design notes & details</b></summary> **Where.** `StorageCleanupTaskRepository.create` is the only place cleanup tasks are made: table, volume, model and model-version drops. The class keeps its name and implements the new `CleanupTaskRepository` interface, so an audit decorator can wrap it. `Repositories` and `StorageCleanupWorker` use the interface type. **After commit.** The decorator registers a Hibernate `Synchronization` and records on `STATUS_COMMITTED` only. With UC's resource-local transactions, Hibernate reports a rollback as `STATUS_UNKNOWN`, which is why the check is "committed" rather than "not rolled back". Hibernate rethrows exceptions from `afterCompletion` out of `commit()`, which would turn a committed drop into an error. So the whole callback is guarded, and failures are logged like other audit failures. **Tests.** - `SdkTableAccessControlCRUDTest.auditRecordsGrantsRevokeDropAndUserDelete`: a drop writes `QUEUE_CLEANUP` and then `CLEAR_RESOURCE_GRANTS`, both from the admin. - `AuditorTest.afterCommitRunsOnlyOnCommitAndNeverFailsIt`: on a real session, a rolled-back transaction runs nothing, and an action that throws does not fail the commit. - The table, volume and model cleanup suites build audited repositories and check in `@AfterEach` that each task has exactly one `QUEUE_CLEANUP` record with its ID and location, across rolled-back and cascading drops (for example `taskInsertFailureRollsBackTableDeletion`). - The decorator check in `AuditorTest`. </details> This pull request and its description were written by Isaac. --------- Signed-off-by: Shubham Bansal <[email protected]> Co-authored-by: Isaac <[email protected]>
🥞 Stacked PR
#2028 is merged, so this PR's Files changed tab shows only its own changes.
PR Checklist
docsis updatedDescription of changes
Builds on #2028 (merged). The Java API changes of #2028 (
StorageCredentialVendoris an interface, andFileOperations.getCleanupFileIOtakes the dropped object's ID) are described there; this PR adds none. With audit and authorization on, the server also records each permission change:GRANTandREVOKE(including the implicitOWNERon create and the admin grant at first start),CLEAR_RESOURCE_GRANTSwhen an object is dropped, andCLEAR_PRINCIPAL_GRANTSwhen a user is deleted. A grant is recorded when it adds one. A revoke or a clear is recorded once it finishes without throwing, whether or not it removed a grant: with several servers on one database, a server can't always tell whether its own copy of the grants changed. If the database delete fails, the request fails and nothing is recorded.It also pins
dev.failsafe:failsafeto 3.2.3.iceberg-awsbrings Failsafe 3.3.2, which removedExecutionContext.getLastFailure; jdbc-adapter 2.13.0 (the latest release) still calls it when a policy write keeps failing, so a failed revoke threwNoSuchMethodErrorinstead of the adapter'sErrorwrapping theSQLException.iceberg-awsonly uses Failsafe APIs that 3.2.3 has. ATODOlinks the upstream fix (apache/casbin-jcasbin-jdbc-adapter#94, merged, not yet released); the pin goes once a release includes it.JCasbinAuthorizerTest.failedDeleteThrowsTheDatabaseErrorfailed before the pin and passes with it.📐 Design notes & details
Fields. Each record has:
principal_id, whose grants changed;resource_id;privilege, using the API's names, for exampleUSE CATALOG.Where.
AuditingAuthorizerdecorator wrapsJCasbinAuthorizerbeforeinitializeAdmin, so the admin grant is recorded.true. A revoke or a clear is recorded whenever the call returns, because with several servers on one database the returned flag only says whether this server's in-memory policy changed.refreshAuthorizationsandclose.Auditor.wrap(UnityCatalogAuthorizer).AllowingAuthorizer), grants are no-ops and nothing is recorded.User outside a request. A record made without a request names the service user
system:server. Today that's only the admin grant at startup. Cleanup credentials keepsystem:storage-cleanup.Tests.
SdkTableAccessControlCRUDTest.auditRecordsGrantsRevokeDropAndUserDeletecovers:principal_idin the record and in the JSON.The decorator check in
AuditorTestcovers the new class.This pull request and its description were written by Isaac.