From 7a63a411165ca9ba3a87b764fc1a3519c96fdcfb Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 14 Feb 2026 16:50:35 -0500 Subject: [PATCH] Make WriteToStdin input zeroization optional --- back/cmd.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/back/cmd.go b/back/cmd.go index 16be1eb..75b1aa8 100644 --- a/back/cmd.go +++ b/back/cmd.go @@ -11,7 +11,7 @@ import ( ) // WriteToStdin is a utility function that writes a byte slice to a command's stdin. -func WriteToStdinAndZeroizeInput(cmd *exec.Cmd, input []byte) error { +func WriteToStdin(cmd *exec.Cmd, input []byte, zeroizeInput bool) error { stdin, err := cmd.StdinPipe() if err != nil { return errors.New("unable to access stdin for system command: " + err.Error()) @@ -21,7 +21,9 @@ func WriteToStdinAndZeroizeInput(cmd *exec.Cmd, input []byte) error { _ = stdin.Close() // error ignored; if stdin could be accessed, it can probably be closed }(stdin) _, _ = stdin.Write(input) - security.ZeroizeBytes(input) + if zeroizeInput { + security.ZeroizeBytes(input) + } }() return nil }