feat(audit): Add user_agent, user_roles, and auth_method to audit events - #6344
feat(audit): Add user_agent, user_roles, and auth_method to audit events#6344Taiwo435 wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍(Review updated until commit d9fe7ca)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to d9fe7ca Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 82db9ad
Suggestions up to commit 9ac7d7f
|
9ac7d7f to
82db9ad
Compare
|
Persistent review updated to latest commit 82db9ad |
Enrich FGAC audit events with three high-value fields for investigability: - audit_request_user_agent: extracted from REST headers in addRestRequestInfo() - audit_request_user_roles: mapped security roles from User.getSecurityRoles() - audit_request_auth_method: authentication backend from User.getAuthenticatedBy() Added enrichWithUserContext() helper to AbstractAuditLog, called from: logFailedLogin, logSucceededLogin, logMissingPrivileges (REST+transport), logGrantedPrivileges (REST+transport), logIndexEvent, logClusterSettingsChange, logIndexSettingsChange, logSecurityIndexAttempt. Graceful degradation: fields are absent (not null/empty) when User object is unavailable (failed login) or when admin cert bypasses auth pipeline. Integration tests (12): verify field presence on AUTHENTICATED, GRANTED_PRIVILEGES, MISSING_PRIVILEGES, FAILED_LOGIN, INDEX_EVENT, CLUSTER_SETTINGS_CHANGED, OPENDISTRO_SECURITY_INDEX_ATTEMPT, plus edge cases for admin cert, no-roles user, and multiple roles. Signed-off-by: Muzzamil Jolaade <muzzajol@amazon.com>
82db9ad to
d9fe7ca
Compare
|
Persistent review updated to latest commit d9fe7ca |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6344 +/- ##
==========================================
- Coverage 75.39% 75.33% -0.06%
==========================================
Files 456 456
Lines 29924 29964 +40
Branches 4530 4534 +4
==========================================
+ Hits 22560 22574 +14
- Misses 5265 5286 +21
- Partials 2099 2104 +5
🚀 New features to boost your workflow:
|
Description
Enrich FGAC audit events with three fields that improve investigability:
audit_request_user_agent: User-Agent string from REST headersaudit_request_user_roles: mapped security roles from the authenticated useraudit_request_auth_method: authentication backend that validated the user (e.g.,internal,ldap)Why
Current audit events identify WHO (effective_user) and WHAT (action, indices) but not HOW they authenticated or what role granted them access. Incident investigators need these fields to answer: "Was this a service account or human?", "Which role allowed this?", "What client tool was used?"
How it works
enrichWithUserContext()helper toAbstractAuditLogTesting
AuditFieldEnrichmentTestcovering:Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.