diff --git a/agent/consul/catalog_endpoint.go b/agent/consul/catalog_endpoint.go index 301e00974c..04be323cb5 100644 --- a/agent/consul/catalog_endpoint.go +++ b/agent/consul/catalog_endpoint.go @@ -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 @@ -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,