crypto: remove INT_MAX restriction in randomBytes#47559
Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom Apr 17, 2023
Merged
Conversation
This restriction was due to an implementation detail in CSPRNG(). Now that CSPRNG() properly handles lengths exceeding INT_MAX, remove this artificial restriction. Refs: nodejs#47515
Collaborator
|
Review requested:
|
This comment was marked as outdated.
This comment was marked as outdated.
anonrig
approved these changes
Apr 14, 2023
Member
|
So... on the one hand I feel arbitrary limitations are bad. On the other hand, there isn't ever a good reason to request so much random data. It's more likely the result of buggy code than really wanting to grab gigabytes of randomness. Bugs like that are also angle for resource exhaustion bugs (thread pool starvation in this case) so ceteris paribus rather than increasing the limit I suggest lowering it. |
Member
Author
|
That's a valid point, but if someone wants to introduce an explicit smaller limit (and for a different reason), I think that should be a separate discussion/change, especially considering that it would be semver-major. |
Member
|
Fair enough. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
panva
approved these changes
Apr 17, 2023
Collaborator
|
Landed in b342a1b |
35 tasks
MoLow
pushed a commit
to MoLow/node
that referenced
this pull request
Jul 6, 2023
This restriction was due to an implementation detail in CSPRNG(). Now that CSPRNG() properly handles lengths exceeding INT_MAX, remove this artificial restriction. Refs: nodejs#47515 PR-URL: nodejs#47559 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
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.
This restriction was due to an implementation detail in
CSPRNG(). Now thatCSPRNG()properly handles lengths exceedingINT_MAX, remove this artificial restriction.Refs: #47515