Skip to content

Commit

Permalink
Merge pull request #479 from uselagoon/fix-token
Browse files Browse the repository at this point in the history
fix: use correct type in user ID context key
  • Loading branch information
smlx authored Oct 15, 2024
2 parents 7c93f5c + 6741a96 commit 503c057
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/lagoondb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func (c *Client) UserBySSHFingerprint(
}
return nil, err
}
// usid column in set NOT NULL, so this should be impossible
if user.UUID == nil {
return nil, errors.New("NULL user UUID")
}
return &user, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/sshtoken/authhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func pubKeyAuth(log *slog.Logger, ldb LagoonDBService) ssh.PublicKeyHandler {
// successful. Inject the user UUID into the context so it can be used in
// the session handler.
authnSuccessTotal.Inc()
ctx.SetValue(userUUIDkey, user.UUID)
ctx.SetValue(userUUIDkey, *user.UUID)
log.Info("authentication successful",
slog.String("userUUID", user.UUID.String()))
return true
Expand Down

0 comments on commit 503c057

Please sign in to comment.