Skip to content

fix: plaintextLength must be enforced - #213

Merged
seebees merged 4 commits into
aws:masterfrom
seebees:plaintext_length
Sep 19, 2019
Merged

seebees merged 4 commits into
aws:masterfrom
seebees:plaintext_length

Conversation

@seebees

@seebees seebees commented Sep 16, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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