Skip to content
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

fix: plaintextLength must be enforced #213

Merged
merged 4 commits into from
Sep 19, 2019
Merged

Conversation

seebees
Copy link
Contributor

@seebees seebees commented Sep 16, 2019

If the user has expressed a plaintext length,
this value MUST not be exceed.

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

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.
If the user has expressed a plaintext length,
this value MUST not be exceed.
@seebees seebees requested a review from a team September 16, 2019 16:37
* The Maximum.BYTES_PER_CACHED_KEY_LIMIT is set to be within Number.MAX_SAFE_INTEGER
* See serialize/identifiers.ts enum Maximum for more details.
*/
needs(!plaintextLength || (plaintextLength >= 0 && Maximum.BYTES_PER_CACHED_KEY_LIMIT >= plaintextLength), 'plaintextLength 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.

Per offline discussion, Maximum.BYTES_PER_CACHED_KEY_LIMIT is the incorrect limit to apply here.
It should be Maximum.FRAME_COUNT * Maximum.FRAME_SIZE.
Because of the JS number limitations, this ends up needing to have the same numerical value, but we need to define it as a separate limit identifier.

@seebees seebees merged commit 1788d25 into aws:master Sep 19, 2019
@seebees seebees deleted the plaintext_length branch September 19, 2019 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants