From b32ea4c1f6ca3d6f8b1af77a5a9bcb89af377dec Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Mon, 18 May 2020 00:21:41 -0400 Subject: [PATCH] cmd/age: add a TODO about not dumping decrypted binary to the terminal --- cmd/age/age.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/age/age.go b/cmd/age/age.go index a2462a7..0185247 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -131,13 +131,15 @@ func main() { } defer f.Close() out = f - } else if terminal.IsTerminal(int(os.Stdout.Fd())) && !decryptFlag { + } else if terminal.IsTerminal(int(os.Stdout.Fd())) { if armorFlag { // If the output will go to a TTY, and it will be armored, buffer it // up so it doesn't get in the way of typing the input. buf := &bytes.Buffer{} defer func() { io.Copy(os.Stdout, buf) }() out = buf + } else if decryptFlag && name != "-" { + // TODO: buffer the output and check it's printable. } else if name != "-" { // If the output wouldn't be armored, refuse to send binary to the // terminal unless explicitly requested with "-o -".