From 93fd6bfeb4ca3708ad898aeaf01faec034be90a7 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 19 Jan 2018 15:25:22 -0800 Subject: [PATCH] Moves the coordinate fetch after the ACL check. --- agent/agent_endpoint.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index c99e3ef14a..96c312a2a8 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -35,14 +35,6 @@ func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (int return nil, MethodNotAllowedError{req.Method, []string{"GET"}} } - var cs lib.CoordinateSet - if !s.agent.config.DisableCoordinates { - var err error - if cs, err = s.agent.GetLANCoordinate(); err != nil { - return nil, err - } - } - // Fetch the ACL token, if any, and enforce agent policy. var token string s.parseToken(req, &token) @@ -54,6 +46,14 @@ func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (int return nil, acl.ErrPermissionDenied } + var cs lib.CoordinateSet + if !s.agent.config.DisableCoordinates { + var err error + if cs, err = s.agent.GetLANCoordinate(); err != nil { + return nil, err + } + } + config := struct { Datacenter string NodeName string