Update password change audit events to include principal name#3760
Open
joemahady-comm wants to merge 2 commits intocloudfoundry:developfrom
Open
Update password change audit events to include principal name#3760joemahady-comm wants to merge 2 commits intocloudfoundry:developfrom
joemahady-comm wants to merge 2 commits intocloudfoundry:developfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a principalName field to AuditEvent so that password change audit events include the human-readable username in log output alongside the existing UUID-based principal field. It also fixes a pre-existing inconsistency in PasswordChangeFailureEvent where principalId used the username instead of the user ID.
Changes:
- Add
principalNamefield toAuditEventwith a new 9-parameter constructor; the existing 8-parameter constructor delegates withnullfor backwards compatibility - Add a
createAuditRecordoverload inAbstractUaaEventacceptingprincipalName, and updatePasswordChangeEventandPasswordChangeFailureEventto supply the username asprincipalName - Update
LoggingAuditServiceto appendprincipalName=[...]to log messages when non-null, and add corresponding unit/integration test coverage
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
server/.../AuditEvent.java |
Adds principalName field, new 9-param constructor (old delegates with null), getter |
server/.../AbstractUaaEvent.java |
Adds new createAuditRecord overload accepting principalName |
server/.../LoggingAuditService.java |
Appends principalName=[...] to log messages when non-null |
server/.../PasswordChangeEvent.java |
Passes username as principalName to createAuditRecord |
server/.../PasswordChangeFailureEvent.java |
Passes user ID as principalId and username as principalName; aligns null-user path |
server/.../LoggingAuditServiceTest.java |
Adds tests for log format with principalName present, with and without authenticationType |
uaa/.../AuditCheckMockMvcTests.java |
Adds assertions for principalName and updates PasswordChangeFailure principal assertion from username to user ID |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
server/src/test/java/org/cloudfoundry/identity/uaa/audit/LoggingAuditServiceTest.java
Show resolved
Hide resolved
server/src/main/java/org/cloudfoundry/identity/uaa/audit/event/AbstractUaaEvent.java
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Password change audit events (PasswordChangeSuccess/PasswordChangeFailure) log the user ID in the principal field but security audit teams need the human-readable username for compliance.
This change introduces a new principalName field in AuditEvent that is included in the log output when present, without modifying the existing principal field.
Changes: