Skip to content

Commit

Permalink
sfxclient/httpsink: use hex encoded string representation for loggabl…
Browse files Browse the repository at this point in the history
…e headers

if sha1 representation bytes is directly converted to string the output is garbage during
logging. Instead use go built-in hex package EncodeToString() api
  • Loading branch information
jgheewala committed Nov 16, 2021
1 parent b2adab8 commit 5e3a0d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sfxclient/httpsink.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"compress/gzip"
"context"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -160,7 +161,7 @@ func getShaValue(values []string) string {
for _, v := range values {
h.Write([]byte(v))
}
return string(h.Sum(nil))
return hex.EncodeToString(h.Sum(nil))
}

// loggableHeaders returns headers that are only allowed to be logged. For instance "X-Sf-Token" should not be logged so
Expand Down

0 comments on commit 5e3a0d3

Please sign in to comment.