From d369e5611df643bd83f951a94b468ef272c1bf3e Mon Sep 17 00:00:00 2001 From: ishaan Date: Wed, 15 Jul 2026 07:51:06 +0530 Subject: bunch of fixes defer file.Close() after os.OpenFile clear(sensitive) before each os.Exit(1) Shared utils.StdinScanner with 512KB buffer bytes.Equal for password comparison, append instead of string() + []byte() --- cmd/eno/cobra.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd/eno/cobra.go') diff --git a/cmd/eno/cobra.go b/cmd/eno/cobra.go index 4a7443e..cf373d5 100644 --- a/cmd/eno/cobra.go +++ b/cmd/eno/cobra.go @@ -70,6 +70,7 @@ var encryptCmd = &cobra.Command{ } encrypted, _, err := crypt.EncryptBytesSSH(fileBytes, pubKeys) if err != nil { + clear(fileBytes) cmd.PrintErrln("Error:", err) os.Exit(1) } @@ -91,6 +92,8 @@ var encryptCmd = &cobra.Command{ encrypted, err := crypt.EncryptBytesPass(fileBytes, password) if err != nil { + clear(fileBytes) + clear(password) cmd.PrintErrln("Error:", err) os.Exit(1) } @@ -166,6 +169,7 @@ var decryptCmd = &cobra.Command{ plaintext, err := crypt.DecryptBytesPass(fileBytes, password) if err != nil { + clear(password) cmd.PrintErrln("Error:", err) os.Exit(1) } -- cgit v1.3