srijeet0406 commented on code in PR #7469:
URL: https://github.com/apache/trafficcontrol/pull/7469#discussion_r1186346259


##########
traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:
##########
@@ -225,10 +225,12 @@ func WrapAccessLog(secret string, h http.Handler) 
http.HandlerFunc {
                user := "-"
                cookieToken := getCookieToken(r)
                cookie, userErr, sysErr := tocookie.Parse(secret, cookieToken)
-               if userErr == nil && sysErr == nil {
-                       user = cookie.AuthData
-               } else {
-                       log.Errorf("Error retrieving user from cookie: User 
Error: %v System Error: %v", userErr, sysErr)
+               if cookie != nil {
+                       if userErr == nil && sysErr == nil {

Review Comment:
   I think you should move line 228 (if cookie != nil) to be inside this `if` 
statement. That way, we are not throwing away the errors in case we get 
something that's actually wrong (other than the cookie being `nil`). The cookie 
being `nil` should be checked just before the line that dereferences the cookie 
struct pointer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to