Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
ThomasK33 wants to merge1 commit intothomask33/09-26-add_detailed_scope_auth_metrics
base:thomask33/09-26-add_detailed_scope_auth_metrics
Choose a base branch
Loading
fromthomask33/09-28-add_api_key_audit_metadata

Conversation

ThomasK33
Copy link
Member

Enhanced API Key Audit Logging

This PR improves audit logging for API keys by:

  1. Adding detailed API key information to audit logs, including:

    • Scopes
    • Allow lists
    • Effective permissions
  2. Including API key metadata in all audit logs when an API key is used for authentication

  3. Adding tests to verify the new audit fields are properly populated

  4. 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.

This was referencedSep 28, 2025
@ThomasK33Graphite App
Copy link
MemberAuthor

ThomasK33 commentedSep 28, 2025
edited
Loading

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.
Learn more

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromb00259f toe9a1439CompareSeptember 28, 2025 21:33
@ThomasK33ThomasK33 marked this pull request as ready for reviewSeptember 29, 2025 07:41
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from8b7a31c to7725526CompareSeptember 29, 2025 08:25
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch frome9a1439 to37565ceCompareSeptember 29, 2025 08:25
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from7725526 toe2539b7CompareSeptember 29, 2025 09:43
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch 2 times, most recently fromd46b7f1 toc9891d7CompareSeptember 29, 2025 09:46
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch frome2539b7 to3bf5bf9CompareSeptember 29, 2025 09:46
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromc9891d7 toa1ba3a5CompareSeptember 29, 2025 09:54
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from3bf5bf9 toaeb80bdCompareSeptember 29, 2025 11:19
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from998cb1d tob3d04caCompareSeptember 30, 2025 14:02
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from13f3b28 to40a63d8CompareSeptember 30, 2025 14:02
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromb3d04ca toafb4b9dCompareOctober 1, 2025 13:56
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch 2 times, most recently from768ff90 tobf26332CompareOctober 2, 2025 07:35
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromafb4b9d to1060d38CompareOctober 2, 2025 07:35
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch frombf26332 tod817f31CompareOctober 2, 2025 17:37
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from1060d38 to403b866CompareOctober 2, 2025 17:37
Comment on lines +406 to +409
ifkey,ok:=httpmw.APIKeyOptional(p.Request);ok {
fields:=APIKeyFields(logCtx,p.Log,key)
additionalFieldsRaw=mergeAdditionalFields(logCtx,p.Log,additionalFieldsRaw,fields)
}
Copy link
Member

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?

@ThomasK33ThomasK33 marked this pull request as draftOctober 3, 2025 16:55
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromd817f31 tob076a30CompareOctober 3, 2025 17:59
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from403b866 to5e40a34CompareOctober 3, 2025 17:59
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromb076a30 tob020309CompareOctober 6, 2025 09:42
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from5e40a34 to4280771CompareOctober 6, 2025 09:42
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromb020309 to37cd2d3CompareOctober 6, 2025 10:11
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from4280771 to384a406CompareOctober 6, 2025 10:11
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from37cd2d3 to807fafeCompareOctober 6, 2025 10:48
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch 2 times, most recently from154d4a1 tocafac8dCompareOctober 6, 2025 11:24
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch 2 times, most recently from7b72854 to5a425afCompareOctober 6, 2025 11:57
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromcafac8d to393492aCompareOctober 6, 2025 11:57
@EmyrkEmyrk self-assigned thisOct 6, 2025
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from5a425af toe408ecfCompareOctober 6, 2025 21:16
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from393492a to2c9a4c1CompareOctober 6, 2025 21:16
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch frome408ecf toab2a24fCompareOctober 6, 2025 21:40
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from2c9a4c1 to7915a16CompareOctober 6, 2025 21:40
For 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.
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from7915a16 toe153689CompareOctober 7, 2025 16:38
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromab2a24f to802b588CompareOctober 7, 2025 16:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn left review comments

@EmyrkEmyrkEmyrk left review comments

Assignees

@ThomasK33ThomasK33

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Audit logging: capture scopes/allow-list on key create/update/use
3 participants
@ThomasK33@johnstcn@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp