Reject invalid Base64 padding in Bytes decoding - #2891
Open
haoshengzhen wants to merge 1 commit into
Open
Conversation
Signed-off-by: haoshengzhen <haoshengzhen@outlook.com>
Author
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.
Summary
This PR makes
Bytes.base64Decode()reject Base64 inputs that contain=padding before the end of the input.Previously,
base64DecodeLookup()accepted=as a valid character anywhere in the input, while thebase64Decode()docs warned that padding in the middle could cause unexpected decoding results. The decoder now enforces that padding can only appear in the final two positions and that padding is contiguous once it starts.Changes
Unreleased / Fixed.Verification
npm run format:check -- CHANGELOG.md src/lib/provable/bytes.ts src/lib/provable/test/base64.unit-test.tsnpx prettier --config .prettierrc.md.cjs --check CHANGELOG.mdgit diff --check