Repository navigation
Conversation
0dc361c to
8db7154
Compare
Record authentication lifecycle events and retain the authenticated principal across failed renewal attempts. Preserve JAAS results when the audit backend throws runtime or linkage errors. Reject conflicting late audit logger configuration before changing the selected backend. Cover enabled, disabled, failed and concurrent initialization and document the audit configuration order.
8db7154 to
9c0dbf2
Compare
|
Claude's comments on the patch: 1. Scope may not match what auditors expect. 2. The user field is misleading for non-Kerberos logins. 3. Failures in the audit logger now surface later and less clearly. 4. Renewal events are counted per attempt, not per renewal. 5. Relogin produces a pair of events. 6. Backports aren’t trivial. 7. The tests are heavy. The tests use reflection on the private reLogin(), static mutable flags in the test login module and logger, and a 10-second latch in the concurrency test. They’re thorough, but some could probably be simplified with a package-private hook. |
|
Backports are not necessarily a problem, but I think other points are worth to think about. Especially with package-private fields you can easily make the tests more lightweight. It's a common practice across the code. |
Use the DIGEST subject username and configured username fallback without changing legacy getUserName behavior. Retain logger initialization errors and reject server startup before opening server data. Exercise renewal directly through package-private access, isolate JAAS fixture state per test, and clarify the local credential audit scope.
|
@anmolnar Thanks for checking this with Claude. I've made the fixes.
|
|
Thanks for the quick response. Here're a few new comments, but all of them are nitpicks, we can merge w/o addressing them once CI is green. New issue
Test nits
|
|
Thanks, Andor, for your time and the careful review. I've updated the description to match the reduced tests. I kept the tests as they are: both exception types exercise the same handler, and the embedded-server test checks logger configuration, so build() is enough for that case. The startup error-path fix can go separately, since it also affects master. |
Preserve the startup exit code if auditing fails, and validate the logger before starting autopurge. Consolidate overlapping JAAS tests.
|
I ended up including the exit-code fix here after all. While checking it, I found that autopurge could delete old snapshots before startup failed on a broken audit logger. That ordering predates this PR. Both CLI and embedded startup now check auditing before starting purge. |
|
Could someone rerun the failed CI job? The previous run passed. |
Problem
JAAS login, logout and Kerberos ticket renewal are missing from the audit log.
Fix
Add
login,logoutandticketRenewalevents through the existing audit provider, enabled byzookeeper.audit.enable. These record local JAAS operations; incoming client and learner SASL authentication failures are outside this patch's scope.user,operationandresult. Identity comes from the subject's Kerberos principal or DIGEST username, with configured JAAS identity and OS user as fallbacks. Failed renewals retain the last authenticated identity.RuntimeExceptionandLinkageErrorfrom the audit logger leave the JAAS result unchanged. Initialization failures are retained so later calls can report the original cause.The audit docs describe this behavior and mark the feature new in 3.10.0.
Tests
Tests cover identity selection, event ordering, renewal retries and skips, disabled auditing, logger failures, and configuration during initialization. Startup tests check exit codes and rejection before autopurge starts.
Both
RuntimeExceptionandLinkageErrorare tested for successful-login and failed-start audit writes. The other logger write failure tests useRuntimeException.Locally, 48 tests pass on Java 17 and 25. SpotBugs and Checkstyle also pass.