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

Add sample, randrange, and getrandbits to B311 random module check? #1215

Closed
aripollak opened this issue Jan 8, 2025 · 2 comments · Fixed by #1235
Closed

Add sample, randrange, and getrandbits to B311 random module check? #1215

aripollak opened this issue Jan 8, 2025 · 2 comments · Fixed by #1235
Labels
enhancement New feature or request

Comments

@aripollak
Copy link
Contributor

aripollak commented Jan 8, 2025

Is your feature request related to a problem? Please describe.
I noticed that random.choice raises a B311 warning here. I assume this is to try to stop someone from using it with a range() in security-related code. I noticed some other random functions that could be used in a similar way but are not currently checked: sample, randrange and getrandbits.

Describe the solution you'd like
Add random.sample, random.randrange, and random.getrandbits to B311 check

Describe alternatives you've considered
None

Additional context
N/A

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

@aripollak aripollak added the enhancement New feature or request label Jan 8, 2025
@lukehinds
Copy link
Member

Sounds like a worthwhile update, do you plan to make the PR @aripollak ?

@aripollak
Copy link
Contributor Author

@lukehinds done in #1235.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants