Skip to content

chore: Update rego to be partial execution friendly #3449

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Spelling
  • Loading branch information
Emyrk committed Aug 10, 2022
commit df75be5ebf08ffb9e8d3db49c65d5eaa4b98dd02
4 changes: 2 additions & 2 deletions coderd/rbac/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,10 @@ func testAuthorize(t *testing.T, name string, subject subject, sets ...[]authTes
}
require.Equal(t, 0, len(result.Support), "expected 0 support rules")

partialAuther, err := authorizer.Prepare(ctx, subject.UserID, subject.Roles, a, c.resource.Type)
partialAuthz, err := authorizer.Prepare(ctx, subject.UserID, subject.Roles, a, c.resource.Type)
require.NoError(t, err, "make prepared authorizer")

partialErr := partialAuther.Authorize(ctx, c.resource)
partialErr := partialAuthz.Authorize(ctx, c.resource)
if authError != nil {
require.Error(t, partialErr, "partial error blocked valid request (false negative)")
} else {
Expand Down
2 changes: 0 additions & 2 deletions coderd/rbac/policy.rego
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ number(set) = c {

default site = 0
site := num {
# relevent are all the permissions that affect the given unknown object
allow := { x |
perm := input.subject.roles[_].site[_]
perm.action in [input.action, "*"]
Expand Down Expand Up @@ -81,7 +80,6 @@ org_mem := true {
default user = 0
user := num {
input.subject.id = input.object.owner
# relevent are all the permissions that affect the given unknown object
allow := { x |
perm := input.subject.roles[_].user[_]
perm.action in [input.action, "*"]
Expand Down