-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
Add more random functions to B311 check #1235
Conversation
for more information, see https://pre-commit.ci
@@ -11,6 +11,9 @@ | |||
bad = random.uniform() | |||
bad = random.triangular() | |||
bad = random.randbytes() | |||
bad = random.sample() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes will require an update to the functional tests to update the count of the number of fail checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might result in more false positives, but likely as much as before with the other random functions. Okay for now, but in the future we may need to consider a better way to detect random used in a cryptographic fashion to isolate a more likely security issue.
Agreed. I was considering a separate feature request to at least allow some obvious non-cryptography cases through, like choices from a constant list or tuple of literals, but I'm not sure how common those would be. |
Fixes #1215.