fix(security): truncate misaligned AES ciphertext instead of throwing#29
Open
ntedvs wants to merge 1 commit intoLibPDF-js:mainfrom
Open
fix(security): truncate misaligned AES ciphertext instead of throwing#29ntedvs wants to merge 1 commit intoLibPDF-js:mainfrom
ntedvs wants to merge 1 commit intoLibPDF-js:mainfrom
Conversation
Contributor
|
@ntedvs is attempting to deploy a commit to the mythie's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Fixes #28
aesDecryptthrew when ciphertext length wasn't a multiple of 16 bytes, crashingPDF.load()entirely for corrupted encrypted PDFs. Now truncates to the nearest block boundary and decrypts what's available.aesDecryptWithIvkeeps its strict validation since it's used for key derivation where misalignment is a real error.Note
decryptObjectindocument-parser.tsstill lacks a general try-catch for other decryption failures (e.g. PKCS#7 padding errors). That's a pre-existing gap, not introduced here, but worth addressing separately.Test plan