Skip to content

Commit 64001b7

Browse files
fixes exposure of sensitive data in log files
1 parent ac91866 commit 64001b7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pkg/daemon/on_disk_validation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
ign2types "github.com/coreos/ignition/config/v2_2/types"
1010
ign3types "github.com/coreos/ignition/v2/config/v3_5/types"
11-
"github.com/google/go-cmp/cmp"
1211
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
1312
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
1413
"k8s.io/apimachinery/pkg/util/sets"
@@ -248,7 +247,9 @@ func checkFileContentsAndMode(filePath string, expectedContent []byte, mode os.F
248247
return fmt.Errorf("could not read file %q: %w", filePath, err)
249248
}
250249
if !bytes.Equal(contents, expectedContent) {
251-
klog.Errorf("content mismatch for file %q (-want +got):\n%s", filePath, cmp.Diff(expectedContent, contents))
250+
// Removing file contents logs to prevent accidental exposure of secrets.
251+
klog.Errorf("content mismatch for file %q (expected %d bytes, got %d bytes)",
252+
filePath, len(expectedContent), len(contents))
252253
return fmt.Errorf("content mismatch for file %q", filePath)
253254
}
254255
return nil

0 commit comments

Comments
 (0)