Skip to content

Commit 835dffb

Browse files
committed
there's more to prevent than an errant split
1 parent 60489c8 commit 835dffb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hubblestack/utils/signing.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,11 @@ def verify_signature(fname, sfname, public_crt='public.crt', ca_crt='ca-root.crt
467467
return STATUS.VERIFIED if both the signature and the CA sig match
468468
"""
469469
log_level = log.debug
470-
short_fname = fname.split('/')[-1] if fname else 'n/a'
470+
if fname is None or sfname is None:
471+
status = STATUS.UNKNOWN
472+
log_level('fname=%s or sfname=%s is Nones => status=%s', fname, sfname, status)
473+
return status
474+
short_fname = fname.split('/')[-1]
471475
try:
472476
with open(sfname, 'r') as fh:
473477
sig,_,_ = PEM.decode(fh.read()) # also returns header and decrypted-status
@@ -477,7 +481,7 @@ def verify_signature(fname, sfname, public_crt='public.crt', ca_crt='ca-root.crt
477481
if check_verif_timestamp(verif_key):
478482
log_level = log.error
479483
log_level('%s | file "%s" | status: %s ', short_fname, fname, status)
480-
return STATUS.UNKNOWN
484+
return status
481485
x509 = X509AwareCertBucket(public_crt, ca_crt)
482486
hasher, chosen_hash = hash_target(fname, obj_mode=True)
483487
digest = hasher.finalize()

0 commit comments

Comments
 (0)