Skip to content

Commit

Permalink
Capture user agent for telemetry purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
punmechanic committed Aug 31, 2023
1 parent 78a9cff commit e9661cc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions api/keyconjurer/serverless_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func (h *Handler) GetUserDataEventHandler(ctx context.Context, req *events.ALBTa
return ErrorResponse(ErrCodeUnableToDecrypt, "unable to decrypt credentials")
}

log = h.log.WithFields(logrus.Fields{"username": event.Credentials.Username, "idp": event.AuthenticationProvider})
log = h.log.WithFields(logrus.Fields{
"username": event.Credentials.Username,
"idp": event.AuthenticationProvider,
"user_agent": req.Headers["user-agent"],
})

provider, ok := providers.Get(event.AuthenticationProvider)
if !ok {
log.Infof("unknown provider %q", provider)
Expand Down Expand Up @@ -189,7 +194,13 @@ func (h *Handler) GetTemporaryCredentialEventHandler(ctx context.Context, req *e
return ErrorResponse(ErrCodeUnableToDecrypt, "unable to decrypt credentials")
}

log = h.log.WithFields(logrus.Fields{"username": event.Credentials.Username, "idp": event.AuthenticationProvider, "account_id": event.AppID})
log = h.log.WithFields(logrus.Fields{
"username": event.Credentials.Username,
"idp": event.AuthenticationProvider,
"user_agent": req.Headers["user-agent"],
"account_id": event.AppID,
})

provider, ok := providers.Get(event.AuthenticationProvider)
if !ok {
log.Infof("unknown provider %q", provider)
Expand Down

0 comments on commit e9661cc

Please sign in to comment.