commit d83078bbbb528eb22fcabf6d39e97fc257c2c1d3
parent 733116bbfe1dcffac4352d9c5476c6a48d214799
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 24 Oct 2021 17:00:12 -0400
if key is empty, that's an error
Diffstat:
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/internal/encdec.go b/internal/encdec.go
@@ -48,6 +48,10 @@ func NewLockbox(key, keyMode, file string) (Lockbox, error) {
return Lockbox{}, err
}
+ if len(b) == 0 {
+ return Lockbox{}, stock.NewBasicError("key is empty")
+ }
+
if len(b) > keyLength {
return Lockbox{}, stock.NewBasicError("key is too large for use")
}
diff --git a/tests/run.sh b/tests/run.sh
@@ -8,6 +8,7 @@ fi
export LOCKBOX_STORE="$TESTS/lb"
export LOCKBOX_KEYMODE="plaintext"
+export LOCKBOX_KEY="plaintextkey"
export LOCKBOX_TOTP="totp"
export LOCKBOX_INTERACTIVE="no"
export PWGEN_SOURCE="$PWD"