Skip to content

Commit

Permalink
Set enterprise metadata after resolving the token (#8302)
Browse files Browse the repository at this point in the history
The token can encode enterprise metadata information, and we must make
sure we set that on the reply so that we can correct filter ACLs.
  • Loading branch information
crhino authored Jul 13, 2020
1 parent 8b5bed1 commit 4d857d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions agent/consul/catalog_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ func (c *Catalog) ListServices(args *structs.DCSpecificRequest, reply *structs.I
return err
}

reply.EnterpriseMeta = args.EnterpriseMeta

authz, err := c.srv.ResolveTokenAndDefaultMeta(args.Token, &args.EnterpriseMeta, nil)
if err != nil {
return err
Expand All @@ -307,6 +305,10 @@ func (c *Catalog) ListServices(args *structs.DCSpecificRequest, reply *structs.I
return err
}

// Set reply enterprise metadata after resolving and validating the token so
// that we can properly infer metadata from the token.
reply.EnterpriseMeta = args.EnterpriseMeta

return c.srv.blockingQuery(
&args.QueryOptions,
&reply.QueryMeta,
Expand Down

0 comments on commit 4d857d1

Please sign in to comment.