Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 8 additions & 4 deletions rbac/custom_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ func matchResourceSelectorPair(pair resourcePair) bool {
if len(pair.selectors) == 0 {
// An attribute was provided but there's no selector to match it against
//
// Essentially, what's happening here is that the permission was not restrictive enough.
// The selector in the permission doesn't care about this attribute.
// So it's authorized.
return true
// Essentially, what's happening here is that the permission is not specific enough.
//
// Example:
// Request: (playbook:run, subject:john, object:playbook.name='foo')
// Should fail when a playbook and config is passed (because the permission has not specified the config)
//
// The request must have been: (playbook:run, subject:john, object:playbook.name='foo'&config:bar)
return false
}

// Must match one of the selectors
Expand Down
2 changes: 1 addition & 1 deletion rbac/custom_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func Test_matchResourceSelector(t *testing.T) {
},
{
name: "2 attributes, 1 selector, match",
want: true,
want: false,
args: args{
attr: models.ABACAttribute{
Connection: models.Connection{
Expand Down