-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyring: Fix a panic when decrypting aead with empty RSA block. #24383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the file itself hasn't been corrupted on-disk, this case is supposed to be protected against by the block above where you've made a change. Older KEK wrapper versions with AEAD-only have the DEK ciphertext in a different field, and we're supposed to be restoring them here.
My hunch would be that there's an issue with those older keys. But unfortunately I tested this out with Nomad 1.4 and did a single-node upgrade to tip and didn't run into any problems.
For the time being, let's get this merged in because it'll prevent a panic.
Clusters that have gone through several upgrades have be found to include keyring material which has an empty RSA block. In more recent versions of Nomad, an empty RSA block is omitted from being written to disk. This results in the panic not being present. Older versions, however, did not have this struct tag meaning we wrote an empty JSON block which is not accounted for in the current version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Older versions, however, did not have this struct tag
🤦
Closes: #24379
The code path exists in 1.9 and 1.8, so backporting to both even though reports suggest this is only occurring on 1.9.0+.
Clusters that have gone through several upgrades have be found to
include keyring material which has an empty RSA block.
In more recent versions of Nomad, an empty RSA block is omitted
from being written to disk. This results in the panic not being
present. Older versions, however, did not have this struct tag
meaning we wrote an empty JSON block which is not accounted for
in the current version.