fix: hint that ciphertext may be base64 encoded - #820
Open
evgpisarchik wants to merge 1 commit into
Open
evgpisarchik wants to merge 1 commit into
evgpisarchik wants to merge 1 commit into
Conversation
A base64-encoded message starts with 0x41 0x59 (V1) or 0x41 0x67 (V2) and currently fails with the generic "Unsupported version 65". deserialize_header now detects these byte pairs and says the message may be base64 encoded. Valid messages are handled exactly as before. Fixes aws#192 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Why
decryptexpects binary ciphertext, but callers may accidentally pass Base64-encoded ciphertext. The message prefixes are transformed as follows:0x01 0x80->0x41 0x59(AY)0x02 0x04/0x05->0x41 0x67(Ag)The parser interprets the leading
0x41as version65and currently returns the genericUnsupported version 65error.What changed
deserialize_headernow recognizes both Base64 prefixes and reports that the message may be Base64 encoded. Valid messages and other invalid inputs retain their existing behavior.Tests cover both V1 and V2 messages.
Fixes #192