- Notifications
You must be signed in to change notification settings - Fork1k
feat: add API key metadata to audit logs#19996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:thomask33/09-26-add_detailed_scope_auth_metrics
Are you sure you want to change the base?
feat: add API key metadata to audit logs#19996
Conversation
ThomasK33 commentedSep 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stackon Graphite.
This stack of pull requests is managed byGraphite. Learn more aboutstacking. |
b00259f
toe9a1439
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
8b7a31c
to7725526
Comparee9a1439
to37565ce
Compare7725526
toe2539b7
Compared46b7f1
toc9891d7
Comparee2539b7
to3bf5bf9
Comparec9891d7
toa1ba3a5
Compare3bf5bf9
toaeb80bd
Compare998cb1d
tob3d04ca
Compare13f3b28
to40a63d8
Compareb3d04ca
toafb4b9d
Compare768ff90
tobf26332
Compareafb4b9d
to1060d38
Comparebf26332
tod817f31
Compare1060d38
to403b866
Compareifkey,ok:=httpmw.APIKeyOptional(p.Request);ok { | ||
fields:=APIKeyFields(logCtx,p.Log,key) | ||
additionalFieldsRaw=mergeAdditionalFields(logCtx,p.Log,additionalFieldsRaw,fields) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is this is a lot of extra data to staple to every audit log?
If we are trying to debug rbac failures, the raw input is logged on authz failures. Do we need to have scope metadata on all audit log entries?
d817f31
tob076a30
Compare403b866
to5e40a34
Compareb076a30
tob020309
Compare5e40a34
to4280771
Compareb020309
to37cd2d3
Compare4280771
to384a406
Compare37cd2d3
to807fafe
Compare154d4a1
tocafac8d
Compare7b72854
to5a425af
Comparecafac8d
to393492a
Compare5a425af
toe408ecf
Compare393492a
to2c9a4c1
Comparee408ecf
toab2a24f
Compare2c9a4c1
to7915a16
CompareFor any action authenticated via an API key, the audit log now includesmetadata about the key used for the request. This provides visibilityinto the permissions used to perform an action.The metadata is stored in the `request_api_key` field within the`additional_fields` payload and includes the key's ID, name, scopes,allow list, and its effective/expanded scope.Additionally, when an API key is the subject of a create, update, ordelete action, its own metadata is now stored in the `api_key` fieldto provide a more complete record of the change.
7915a16
toe153689
Compareab2a24f
to802b588
Compare
Enhanced API Key Audit Logging
This PR improves audit logging for API keys by:
Adding detailed API key information to audit logs, including:
Including API key metadata in all audit logs when an API key is used for authentication
Adding tests to verify the new audit fields are properly populated
Updating documentation to reflect that API key scopes and allow lists are now tracked in audit logs
These changes provide administrators with better visibility into API key usage and permissions, making it easier to track and audit API key activities.