Merge pull request #13877 from spowelljr/filterOutEnvs
Don't write logs that contain environment variablespull/13879/head
commit
43c11c7559
|
@ -60,6 +60,8 @@ var (
|
|||
// unexpected errors from libmachine to the user.
|
||||
machineLogErrorRe = regexp.MustCompile(`VirtualizationException`)
|
||||
machineLogWarningRe = regexp.MustCompile(`(?i)warning`)
|
||||
// This regex is to filter out logs that contain environment variables which could contain sensitive information
|
||||
machineLogEnvironmentRe = regexp.MustCompile(`&exec\.Cmd`)
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -122,7 +124,9 @@ type machineLogBridge struct{}
|
|||
|
||||
// Write passes machine driver logs to klog
|
||||
func (lb machineLogBridge) Write(b []byte) (n int, err error) {
|
||||
if machineLogErrorRe.Match(b) {
|
||||
if machineLogEnvironmentRe.Match(b) {
|
||||
return len(b), nil
|
||||
} else if machineLogErrorRe.Match(b) {
|
||||
klog.Errorf("libmachine: %s", b)
|
||||
} else if machineLogWarningRe.Match(b) {
|
||||
klog.Warningf("libmachine: %s", b)
|
||||
|
|
Loading…
Reference in New Issue