Repository navigation
fix(encryption): return DataInvalid for invalid AES key sizes - #3226
Merged
Merged
Conversation
`AesKeySize::from_key_length` and `AesKeySize::from_str` returned `FeatureUnsupported` for anything outside 128/192/256-bit. AES defines no other key sizes, so these are invalid input rather than something a later version could support, and `FeatureUnsupported` here is indistinguishable from the genuinely unsupported cases such as an unknown key metadata version. `from_key_length` is reachable from `SecureKey::new`, `StandardKeyMetadata::try_new` and the `encryption.data-key-length` table property, all of which now surface `DataInvalid`. Messages change from "Unsupported ..." to "Invalid ..." to match.
Contributor
Author
|
@blackmwk @kevinjqliu hopefully not controversial |
blackmwk
approved these changes
Sep 15, 2026
blackmwk
left a comment
Contributor
There was a problem hiding this comment.
Thanks @xanderbailey for this fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AesKeySize::from_key_lengthandAesKeySize::from_strreturnedFeatureUnsupportedfor anything outside 128/192/256-bit. AES defines no other key sizes, so these are invalid input rather than something a later version could support, andFeatureUnsupportedhere is indistinguishable from the genuinely unsupported cases such as an unknown key metadata version.from_key_lengthis reachable fromSecureKey::new,StandardKeyMetadata::try_newand theencryption.data-key-lengthtable property, all of which now surfaceDataInvalid. Messages change from "Unsupported ..." to "Invalid ..." to match.Which issue does this PR close?
What changes are included in this PR?
Are these changes tested?
AI Disclosure