Skip to content

Commit

Permalink
Use auth context when evaluating service read permissions
Browse files Browse the repository at this point in the history
Co-Authored-By: Blake Covarrubias <1812+blake@users.noreply.github.com>
  • Loading branch information
nathancoleman and blake committed May 1, 2023
1 parent 90fc9bd commit 4bb7d00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions agent/proxycfg-glue/resolved_service_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/hashicorp/go-memdb"

"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/cache"
cachetype "github.com/hashicorp/consul/agent/cache-types"
"github.com/hashicorp/consul/agent/configentry"
Expand Down Expand Up @@ -41,12 +42,13 @@ func (s *serverResolvedServiceConfig) Notify(ctx context.Context, req *structs.S

return watch.ServerLocalNotify(ctx, correlationID, s.deps.GetStore,
func(ws memdb.WatchSet, store Store) (uint64, *structs.ServiceConfigResponse, error) {
authz, err := s.deps.ACLResolver.ResolveTokenAndDefaultMeta(req.Token, &req.EnterpriseMeta, nil)
var authzContext acl.AuthorizerContext
authz, err := s.deps.ACLResolver.ResolveTokenAndDefaultMeta(req.Token, &req.EnterpriseMeta, &authzContext)
if err != nil {
return 0, nil, err
}

if err := authz.ToAllowAuthorizer().ServiceReadAllowed(req.Name, nil); err != nil {
if err := authz.ToAllowAuthorizer().ServiceReadAllowed(req.Name, &authzContext); err != nil {
return 0, nil, err
}

Expand Down

0 comments on commit 4bb7d00

Please sign in to comment.