Repository navigation
fix(x): accept 24-byte encryption keys and reject 64-byte keys - #9901
VfourTwenty wants to merge 1 commit into
Conversation
Signed-off-by: VfourTwenty <132915930+VfourTwenty@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
Fixes #9898.
x.GetEncAclKeyschecked the--encryption/--vaultkey for a length of 16, 32 or 64 bytes. AES and Badger accept 16, 24 or 32, and the--encryptionhelp text and the docs say the same. So a 24-byte (AES-192) key was refused at start, and a 64-byte key passed the check and the alpha then exited in Badger'sOpenKeyRegistry.The check now accepts 16, 24 or 32 bytes, and the error message lists those lengths. Both the key-file and the Vault paths go through this check.
Added
TestGetEncAclKeysEncKeyLengthinx/acl_enc_keys_test.go: it writes keys of 0, 15, 16, 24, 32, 33 and 64 bytes to a temp file and checks that only 16, 24 and 32 are accepted. Onmainthe 24- and 64-byte cases fail, with the change all pass. Rango test ./x/ -run TestGetEncAclKeys,go vet ./x/, gofmt and golangci-lint 2.15.0 with the trunk config in docker (golang:1.27.3): no issues in the changed lines (the 6 staticcheck findings it reports inx/are already onmain).Checklist
fix:,feat:,chore:,ci:, etc.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit