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 scope enforcement metrics to RBAC authorizer#19991

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

Conversation

ThomasK33
Copy link
Member

Add scope enforcement metrics to RBAC authorizer

This PR adds detailed metrics to track scope enforcement decisions in the RBAC authorizer. It helps us understand why requests are allowed or denied, particularly focusing on scope-based decisions versus role or ACL-based decisions.

The changes include:

  • NewscopeDecision struct to track detailed authorization outcomes
  • Additional Prometheus metrics to track scope enforcement:
    • coderd_authz_scope_enforcement_total - Counts requests by decision type
    • coderd_authz_scope_enforcement_duration_seconds - Measures latency
    • coderd_authz_scope_allowlist_miss_total - Tracks allow-list misses
  • Updated Rego policy to expose structured decision data
  • Documentation with example PromQL queries for common analysis scenarios

These metrics will help us better understand authorization patterns and identify potential issues with scope configurations.

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

ThomasK33 commentedSep 26, 2025
edited
Loading

@ThomasK33ThomasK33 linked an issueSep 26, 2025 that may beclosed by this pull request
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch 2 times, most recently from9d9f50a toa7dd13bCompareSeptember 26, 2025 19:57
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch fromf277494 to51502b5CompareSeptember 28, 2025 10:53
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch froma7dd13b to8b7a31cCompareSeptember 28, 2025 10:53
@ThomasK33ThomasK33 marked this pull request as ready for reviewSeptember 28, 2025 11:08
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from8b7a31c to7725526CompareSeptember 29, 2025 08:25
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch from51502b5 to9384a37CompareSeptember 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-26-add_token_scope_support_in_cli branch 2 times, most recently from968cd55 to23c8b74CompareSeptember 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-26-add_detailed_scope_auth_metrics branch 2 times, most recently frombf26332 tod817f31CompareOctober 2, 2025 17:37
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch fromfa49bdc tod7fcc25CompareOctober 2, 2025 17:37
@ThomasK33ThomasK33 marked this pull request as draftOctober 2, 2025 17:37
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch fromd7fcc25 toc4f8c2aCompareOctober 3, 2025 17:59
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch 2 times, most recently fromb076a30 tob020309CompareOctober 6, 2025 09:42
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch 2 times, most recently from6ec4b94 tod9f66caCompareOctober 6, 2025 10:10
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch 2 times, most recently from37cd2d3 to807fafeCompareOctober 6, 2025 10:48
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch 2 times, most recently from11f6a63 to75d7b64CompareOctober 6, 2025 11:24
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from807fafe to7b72854CompareOctober 6, 2025 11:24
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch from75d7b64 tof244193CompareOctober 6, 2025 11:57
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from7b72854 to5a425afCompareOctober 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-26-add_token_scope_support_in_cli branch fromf244193 to2f3304eCompareOctober 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-26-add_token_scope_support_in_cli branch from2f3304e to1dae22eCompareOctober 6, 2025 21:40
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromab2a24f to802b588CompareOctober 7, 2025 16:38
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch 2 times, most recently from7eb739c todc96969CompareOctober 9, 2025 12:54
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch from802b588 tocb61426CompareOctober 9, 2025 12:55
This change introduces new Prometheus metrics to provide detailed insightsinto authorization decisions, particularly for API key scopes. Thesemetrics help administrators understand why a request was allowed ordenied by breaking down the outcome.The new metrics are:- `coderd_authz_scope_enforcement_total`: Classifies each authorization  request by its outcome (e.g., scope_allow, scope_deny,  allow_list_deny) and resource type.- `coderd_authz_scope_enforcement_duration_seconds`: Measures the latency  of scope enforcement decisions.- `coderd_authz_scope_allowlist_miss_total`: Tracks requests denied  specifically due to a resource not being in a scope's allow-list.To implement this efficiently, a new `scope_metrics` rule was added tothe Rego policy. This allows the authorizer to gather detailed outcomeinformation in a single evaluation, avoiding redundant computations.The documentation for Prometheus has been updated to include details andexample queries for the new metrics.
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_token_scope_support_in_cli branch fromdc96969 to521c665CompareOctober 9, 2025 13:06
@ThomasK33ThomasK33force-pushed thethomask33/09-26-add_detailed_scope_auth_metrics branch fromcb61426 to06d4957CompareOctober 9, 2025 13:06
@ThomasK33ThomasK33 deleted the thomask33/09-26-add_detailed_scope_auth_metrics branchOctober 9, 2025 15:37
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping left review comments

@EmyrkEmyrkEmyrk requested changes

Assignees

@ThomasK33ThomasK33

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Telemetry/metrics: scope enforcement visibility
3 participants
@ThomasK33@dannykopping@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp