-
Notifications
You must be signed in to change notification settings - Fork 63
fix: maxBodySize can not short circuit on frameLengh #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,21 @@ describe('decrypt', () => { | |
{ encoding: 'base64' } | ||
)).to.rejectedWith(Error, 'Invalid Signature') | ||
}) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No unit tests for ParseHeaderStream? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifically, no. But implicitly, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless there is some reason why unit tests for ParseHeaderStream specifically would not be useful, we should add them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
it('can decrypt maxBodySize message with a single final frame.', async () => { | ||
const { plaintext: test } = await decrypt( | ||
fixtures.decryptKeyring(), | ||
fixtures.base64Ciphertext4BytesWith4KFrameLength(), | ||
{ encoding: 'base64', maxBodySize: 4 } | ||
) | ||
expect(test).to.deep.equal(Buffer.from('asdf')) | ||
}) | ||
|
||
it('will not decrypt data that exceeds maxBodySize.', async () => { | ||
return expect(decrypt( | ||
fixtures.decryptKeyring(), | ||
fixtures.base64Ciphertext4BytesWith4KFrameLength(), | ||
{ encoding: 'base64', maxBodySize: 3 } | ||
)).to.rejectedWith(Error, 'maxBodySize exceeded.') | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update https://github.com/awslabs/aws-encryption-sdk-javascript/blob/master/modules/decrypt-node/src/decrypt_stream.ts#L43 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm following...
https://github.com/awslabs/aws-encryption-sdk-javascript/pull/181/files#diff-a2a13589c6d6b1804302d56578057d38R43
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh weird, for some reason I missed that change. Ignore me.