- Notifications
You must be signed in to change notification settings - Fork923
chore: authz 'any_org' to return if at least 1 org has perms#14009
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e8e940e
3ea9020
3b0fae0
6b3e053
9cd9c82
ad298a8
f5c4f9a
40a8786
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I checked the RBAC benchmarks before/after and didn't see any concerning differences here 👍 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -590,6 +590,46 @@ func TestRolePermissions(t *testing.T) { | ||
false: {}, | ||
}, | ||
}, | ||
// AnyOrganization tests | ||
{ | ||
Name: "CreateOrgMember", | ||
Actions: []policy.Action{policy.ActionCreate}, | ||
Resource: rbac.ResourceOrganizationMember.AnyOrganization(), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, userAdmin, orgAdmin, otherOrgAdmin, orgUserAdmin, otherOrgUserAdmin}, | ||
false: { | ||
memberMe, templateAdmin, | ||
orgTemplateAdmin, orgMemberMe, orgAuditor, | ||
otherOrgMember, otherOrgAuditor, otherOrgTemplateAdmin, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Name: "CreateTemplateAnyOrg", | ||
Actions: []policy.Action{policy.ActionCreate}, | ||
Resource: rbac.ResourceTemplate.AnyOrganization(), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, templateAdmin, orgTemplateAdmin, otherOrgTemplateAdmin, orgAdmin, otherOrgAdmin}, | ||
false: { | ||
userAdmin, memberMe, | ||
orgMemberMe, orgAuditor, orgUserAdmin, | ||
otherOrgMember, otherOrgAuditor, otherOrgUserAdmin, | ||
}, | ||
}, | ||
}, | ||
Comment on lines +607 to +619 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Can you extend these tests to other organization-scoped RBAC objects?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I can add more tests for sure. The test you wrote is missing with The correct question to see if you can make a workspace belonging to yourself is:
The reason the test without the owner works for some roles, is because owners and org admins are able to create workspaces on behalf of other users Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ah whoops 👍 I'm still holding the package wrong! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It's not perfect for sure. Maybe there is some api wrapper that could exist that translates everything into some more readable language 🤷♂️. I agree it's nuanced | ||
{ | ||
Name: "CreateWorkspaceAnyOrg", | ||
Actions: []policy.Action{policy.ActionCreate}, | ||
Resource: rbac.ResourceWorkspace.AnyOrganization().WithOwner(currentUser.String()), | ||
AuthorizeMap: map[bool][]hasAuthSubjects{ | ||
true: {owner, orgAdmin, otherOrgAdmin, orgMemberMe}, | ||
false: { | ||
memberMe, userAdmin, templateAdmin, | ||
orgAuditor, orgUserAdmin, orgTemplateAdmin, | ||
otherOrgMember, otherOrgAuditor, otherOrgUserAdmin, otherOrgTemplateAdmin, | ||
}, | ||
}, | ||
}, | ||
} | ||
// We expect every permission to be tested above. | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.