Skip to content

Commit e171bb1

Browse files
committed
fix null pointer
1 parent 6f164ae commit e171bb1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/nacp/nacp.go

+5
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ func NewProxyHandler(nomadAddress *url.URL, jobHandler *admissionctrl.JobHandler
148148
reqCtx.AccessorID = tokenInfo.AccessorID
149149
reqCtx.TokenInfo = tokenInfo
150150
}
151+
}
152+
153+
// Even tho we have resolveToken set to true, the initial connection will be issued without a token for the auth
154+
// so it's better to validate whether it's populated or not
155+
if reqCtx.TokenInfo != nil {
151156
appLogger.Info("Request received", "path", r.URL.Path, "method", r.Method, "clientIP", reqCtx.ClientIP, "accessorID", reqCtx.AccessorID)
152157
} else {
153158
appLogger.Info("Request received", "path", r.URL.Path, "method", r.Method, "clientIP", reqCtx.ClientIP)

0 commit comments

Comments
 (0)