Add secure_random functions#17399
Merged
rschlussel merged 1 commit intoprestodb:masterfrom Mar 7, 2022
Merged
Conversation
05ee558 to
b8c6132
Compare
b8c6132 to
7aa41ab
Compare
rschlussel
reviewed
Mar 4, 2022
presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
I'm not sure we want to catch a noSuchAlgorithmException because it means we would basically never know if NativePRNGNonBlocking wasn't being used. It would be better to throw an internal error.
Contributor
Author
There was a problem hiding this comment.
Thanks for reviewing my PR!
Actually NativePRNGNonBlocking is an OS specific secure random implementation. See this post.
I will extract the os-specific secure random algorithm as a static variable then.
For exception handling, I can definitely wrap NoSuchAlgorithmException into a PrestoException and throw it.
Contributor
|
Also, we avoid merge commits. Can you rebase your change on master instead? |
f7c19a2 to
ce87a31
Compare
ce87a31 to
8ed093e
Compare
rschlussel
approved these changes
Mar 7, 2022
9 tasks
9 tasks
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.
Currently all presto
random()functions return a pseudo-random number.Implement
secure_random()functions returning a cryptographically secure random number between lower (inclusive) and upper (exclusive).Test plan - unit tests and verifier run
Fill in the release notes towards the bottom of the PR description.
See Release Notes Guidelines for details.