acl: fix bug in 'consul members' filtering with partitions (#11263)

This commit is contained in:
R.B. Boyer 2021-10-13 09:18:16 -05:00 committed by GitHub
parent 585f78f35a
commit 0c94095dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

3
.changelog/11263.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
acl: **(Enterprise only)** Fix bug in 'consul members' filtering with partitions.
```

View File

@ -150,11 +150,11 @@ func (a *Agent) filterMembers(token string, members *[]serf.Member) error {
}
var authzContext acl.AuthorizerContext
a.agentEnterpriseMeta().FillAuthzContext(&authzContext)
// Filter out members based on the node policy.
m := *members
for i := 0; i < len(m); i++ {
node := m[i].Name
serfMemberFillAuthzContext(&m[i], &authzContext)
if authz.NodeRead(node, &authzContext) == acl.Allow {
continue
}

13
agent/acl_oss.go Normal file
View File

@ -0,0 +1,13 @@
// +build !consulent
package agent
import (
"github.com/hashicorp/serf/serf"
"github.com/hashicorp/consul/acl"
)
func serfMemberFillAuthzContext(m *serf.Member, ctx *acl.AuthorizerContext) {
// no-op
}