Skip to content

Commit b83c254

Browse files
feat: use hexString instead of pubkey bytes for error logging. (#1636)
1 parent 7ef4863 commit b83c254

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/nodeauth/jwt/node_jwt_authenticator.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package jwt
33
import (
44
"context"
55
"crypto/ed25519"
6+
"encoding/hex"
67
"fmt"
78
"log/slog"
89

@@ -62,21 +63,21 @@ func (v *NodeJWTAuthenticator) AuthenticateJWT(ctx context.Context, tokenString
6263
isValid, err := v.nodeAuthProvider.IsNodePubKeyTrusted(ctx, publicKey)
6364
if err != nil {
6465
v.logger.Error("Node validation failed",
65-
"csaPubKey", publicKey,
66+
"csaPubKey", hex.EncodeToString(publicKey),
6667
"error", err,
6768
)
6869
return false, claims, fmt.Errorf("node validation failed: %w", err)
6970
}
7071

7172
if !isValid {
7273
v.logger.Warn("Unauthorized node attempted access",
73-
"csaPubKey", publicKey,
74+
"csaPubKey", hex.EncodeToString(publicKey),
7475
)
75-
return false, claims, fmt.Errorf("unauthorized node: %s", publicKey)
76+
return false, claims, fmt.Errorf("unauthorized node: %s", hex.EncodeToString(publicKey))
7677
}
7778

7879
v.logger.Debug("JWT validation successful",
79-
"csaPubKey", publicKey,
80+
"csaPubKey", hex.EncodeToString(publicKey),
8081
)
8182

8283
return true, claims, nil

0 commit comments

Comments
 (0)