-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement redaction of sensitive data in logs (#158)
* Implement redaction of sensitive data in logs * Redact sensitive information from error logging in proxyHTTP
- Loading branch information
1 parent
f6bb644
commit 1200d1b
Showing
6 changed files
with
51 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build !prod | ||
|
||
package logger | ||
|
||
import "fmt" | ||
|
||
// Redacted redacts sensitive data in production logs. | ||
// In non-production environments, it returns the string representation of the input value. | ||
// In a production environment, it always returns the constant "[REDACTED]" to ensure sensitive information is not exposed. | ||
func Redacted(input any) string { | ||
return fmt.Sprint(input) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build prod | ||
|
||
package logger | ||
|
||
// Redacted redacts sensitive data in production logs. | ||
// In non-production environments, it returns the string representation of the input value. | ||
// In a production environment, it always returns the constant "[REDACTED]" to ensure sensitive information is not exposed. | ||
func Redacted(input any) string { | ||
return "[REDACTED]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters