Skip to content

Commit ac1c01d

Browse files
committed
backport of commit 0a059cf
1 parent 234aee8 commit ac1c01d

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

nomad/acl.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,9 @@ func (s *Server) remoteIPFromRPCContext(ctx *RPCContext) (net.IP, error) {
161161
// for the identity they intend the operation to be performed with.
162162
func (s *Server) ResolveACL(args structs.RequestWithIdentity) (*acl.ACL, error) {
163163
identity := args.GetIdentity()
164-
if !s.config.ACLEnabled {
164+
if !s.config.ACLEnabled || identity == nil {
165165
return nil, nil
166166
}
167-
if identity == nil {
168-
// Server.Authenticate should never return a nil identity unless there's
169-
// an authentication error, but enforce that invariant here
170-
return nil, structs.ErrPermissionDenied
171-
}
172167
aclToken := identity.GetACLToken()
173168
if aclToken != nil {
174169
return s.ResolveACLForToken(aclToken)
@@ -177,10 +172,7 @@ func (s *Server) ResolveACL(args structs.RequestWithIdentity) (*acl.ACL, error)
177172
if claims != nil {
178173
return s.ResolveClaims(claims)
179174
}
180-
181-
// return an error here so that we enforce the invariant that we check for
182-
// Identity.ClientID before trying to resolve ACLs
183-
return nil, structs.ErrPermissionDenied
175+
return nil, nil
184176
}
185177

186178
// ResolveACLForToken resolves an ACL from a token only. It should be used only

0 commit comments

Comments
 (0)