Merge pull request #25 from elifarley/elifarley-secret-as-hash
Replace API key redaction with SHA256 hash display
This commit is contained in:
commit
62da19ae2d
1 changed files with 7 additions and 1 deletions
|
|
@ -36,7 +36,13 @@ func SanitizeHeaders(headers http.Header) http.Header {
|
||||||
}
|
}
|
||||||
|
|
||||||
if isSensitive {
|
if isSensitive {
|
||||||
sanitized[key] = []string{"[REDACTED]"}
|
// Calculate SHA256 hash for each sensitive header value
|
||||||
|
hashedValues := make([]string, len(values))
|
||||||
|
for i, value := range values {
|
||||||
|
hash := sha256.Sum256([]byte(value))
|
||||||
|
hashedValues[i] = fmt.Sprintf("sha256:%x", hash)
|
||||||
|
}
|
||||||
|
sanitized[key] = hashedValues
|
||||||
} else {
|
} else {
|
||||||
sanitized[key] = values
|
sanitized[key] = values
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue