Skip to content

fix: frame length can not be 0 #149

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

Merged
merged 4 commits into from
Jul 18, 2019
Merged

Conversation

seebees
Copy link
Contributor

@seebees seebees commented Jul 16, 2019

resolves #129

The other ESDK’s use frameLength === 0 to indicate non-framed content.
The JS ESDK does not support encrypting non-framed content.
A frameLength of 0 will crash the process.
Add condition and test.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

resolves aws#129

The other ESDK’s use frameLength === 0 to indicate non-framed content.
The JS ESDK does not support encrypting non-framed content.
A frameLength of 0 will crash the process.
Add condition and test.
@seebees seebees requested a review from a team July 16, 2019 00:00
@@ -60,6 +62,10 @@ export async function encrypt (
plaintext: Uint8Array,
{ suiteId, encryptionContext, frameLength = FRAME_LENGTH }: EncryptInput = {}
): Promise<EncryptResult> {

/* Precondition: The frameLength must be less than the maximum frame size for browser encryption. */
needs(frameLength > 0 && Maximum.FRAME_SIZE >= frameLength, 'frameLength out of bounds')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add those bounds to the error message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, in both... :)

@seebees seebees force-pushed the frame_length_bounds branch from 477689e to 3f91a93 Compare July 16, 2019 18:11
@seebees seebees merged commit dc1f92e into aws:master Jul 18, 2019
@seebees seebees deleted the frame_length_bounds branch July 18, 2019 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FrameLength can not be zero, and must be less than Maximum. FRAME_SIZE
2 participants