From ce81033aa3625abcc5f12a2ff1c937c22f07bf77 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Thu, 6 Oct 2022 10:30:45 -0400 Subject: [PATCH] enforce keyring has been initialized before getting active key --- nomad/encrypter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nomad/encrypter.go b/nomad/encrypter.go index 7787154144e7..8b3851ff9aed 100644 --- a/nomad/encrypter.go +++ b/nomad/encrypter.go @@ -277,6 +277,9 @@ func (e *Encrypter) activeKeySetLocked() (*keyset, error) { if err != nil { return nil, err } + if keyMeta == nil { + return nil, fmt.Errorf("keyring has not been initialized yet") + } return e.keysetByIDLocked(keyMeta.KeyID) }