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

fix: improve RBAC scope allow list handling for create actions#20008

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

Open
ThomasK33 wants to merge1 commit intothomask33/09-28-add_api_key_audit_metadata
base:thomask33/09-28-add_api_key_audit_metadata
Choose a base branch
Loading
fromthomask33/09-29-feat_typed_rbac_allow_list

Conversation

ThomasK33
Copy link
Member

Fix API key scope authorization for workspace creation

This PR fixes an issue with API key scopes and workspace creation. Previously, the RBAC policy allowed creation of resources with an empty ID in the allow list, but this approach was inconsistent with how other permissions work.

The changes:

  1. Update the Rego policy to properly handle "create" actions by checking if the resource type is in the allow list
  2. Add tests to verify that workspace creation requires a matching type entry in the allow list
  3. Add tests for scope filtering to ensure proper behavior
  4. Add a test to verify that authorization requires a scope
  5. Add a test to ensure workspace agent scope allow lists contain the correct elements

These changes ensure that API key scopes are properly enforced for creation operations while maintaining backward compatibility.

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

ThomasK33 commentedSep 29, 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.

@ThomasK33ThomasK33 linked an issueSep 29, 2025 that may beclosed by this pull request
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from5ac8d9c tobd1ff54CompareSeptember 29, 2025 13:25
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch fromf53f9aa to7a79289CompareSeptember 29, 2025 13:25
@ThomasK33ThomasK33 marked this pull request as ready for reviewSeptember 29, 2025 16:12
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch from7a79289 tof38d137CompareSeptember 29, 2025 16:15
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch frombd1ff54 toeedeed8CompareSeptember 29, 2025 16:15
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch from8390b78 tocb4f67cCompareSeptember 30, 2025 14:02
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch 2 times, most recently fromb3d04ca toafb4b9dCompareOctober 1, 2025 13:56
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch fromcb4f67c tobc0acfcCompareOctober 1, 2025 13:56
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch fromafb4b9d to1060d38CompareOctober 2, 2025 07:35
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch 2 times, most recently fromc410a2c to696cc1dCompareOctober 2, 2025 17:37
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from1060d38 to403b866CompareOctober 2, 2025 17:37
@Emyrk
Copy link
Member

This PR fixes an issue with API key scopes and workspace creation. Previously, the RBAC policy allowed creation of resources with an empty ID in the allow list, but this approach was inconsistent with how other permissions work.

How is this inconsistent with how other permissions work?

The permission to create a workspace istype: workspace, org: <org_id>, owner: <user_id>.
The allow_list taking an empty string might not be the most intuitive, but it does match how permissions work now.

This change allows an object with no uuid to always pass the allow list, but that is not correct imo. That would mean if you grantworkspace:<uuid> then you also grant thecreate permission right?


I don't think we should special case the actioncreate. If we want to make the empty string more intuitive, then we should use some specialid for some actions. The empty string is currently signaling something, and that something should be matched, not ignored.

Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just preventing an accidental merge

@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from403b866 to5e40a34CompareOctober 3, 2025 17:59
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch 2 times, most recently from09d60e6 to4bb9040CompareOctober 6, 2025 09:42
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch 2 times, most recently from4280771 to384a406CompareOctober 6, 2025 10:11
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch 2 times, most recently fromcc44d1c to4c9762eCompareOctober 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-29-feat_typed_rbac_allow_list branch 2 times, most recently fromc9ad043 to610e5e7CompareOctober 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-29-feat_typed_rbac_allow_list branch from610e5e7 to14537dbCompareOctober 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-29-feat_typed_rbac_allow_list branch from14537db tofd7df7cCompareOctober 6, 2025 21:40
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from2c9a4c1 to7915a16CompareOctober 6, 2025 21:40
The allow_list for RBAC scopes has been updated to use typed elementsof the form `{type: string, id: string}` instead of raw string IDs.This change enables more granular authorization policies. Specifically, itmodifies the behavior for "create" actions. A create operation is nowpermitted if the scope's allow_list contains an entry matching theresource type, even without a specific ID. This is useful for scenarioslike workspace agent tokens which need to create resources but cannotknow the ID ahead of time.For all other actions (e.g., read, update, delete), the allow_listmust still contain an entry that matches both the type and the specificID of the resource.The Rego policy, relevant Go code, and tests have been updated toimplement and verify this new typed allow_list behavior.
@ThomasK33ThomasK33force-pushed thethomask33/09-28-add_api_key_audit_metadata branch from7915a16 toe153689CompareOctober 7, 2025 16:38
@ThomasK33ThomasK33force-pushed thethomask33/09-29-feat_typed_rbac_allow_list branch fromfd7df7c to80f543aCompareOctober 7, 2025 16:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@EmyrkEmyrkEmyrk requested changes

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees

@ThomasK33ThomasK33

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

OPA/Policy: ensure scope and allow-list checks
2 participants
@ThomasK33@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp