forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: PyCQA/bandit#940 and PyCQA/bandit#1096
- Loading branch information
1 parent
5dfc2d1
commit e9d2793
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S311.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
import random | ||
|
||
import a_lib | ||
|
||
# OK | ||
random.SystemRandom() | ||
|
||
# Errors | ||
random.Random() | ||
random.random() | ||
random.randrange() | ||
random.randint() | ||
random.choice() | ||
random.choices() | ||
random.uniform() | ||
random.triangular() | ||
|
||
# Unrelated | ||
os.urandom() | ||
a_lib.random() |
This file contains 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
71 changes: 71 additions & 0 deletions
71
...rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S311_S311.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs | ||
--- | ||
S311.py:11:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
9 | # Errors | ||
10 | random.Random() | ||
11 | random.random() | ||
| ^^^^^^^^^^^^^^^ S311 | ||
12 | random.randrange() | ||
13 | random.randint() | ||
| | ||
|
||
S311.py:12:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
10 | random.Random() | ||
11 | random.random() | ||
12 | random.randrange() | ||
| ^^^^^^^^^^^^^^^^^^ S311 | ||
13 | random.randint() | ||
14 | random.choice() | ||
| | ||
|
||
S311.py:13:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
11 | random.random() | ||
12 | random.randrange() | ||
13 | random.randint() | ||
| ^^^^^^^^^^^^^^^^ S311 | ||
14 | random.choice() | ||
15 | random.choices() | ||
| | ||
|
||
S311.py:14:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
12 | random.randrange() | ||
13 | random.randint() | ||
14 | random.choice() | ||
| ^^^^^^^^^^^^^^^ S311 | ||
15 | random.choices() | ||
16 | random.uniform() | ||
| | ||
|
||
S311.py:15:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
13 | random.randint() | ||
14 | random.choice() | ||
15 | random.choices() | ||
| ^^^^^^^^^^^^^^^^ S311 | ||
16 | random.uniform() | ||
17 | random.triangular() | ||
| | ||
|
||
S311.py:16:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
14 | random.choice() | ||
15 | random.choices() | ||
16 | random.uniform() | ||
| ^^^^^^^^^^^^^^^^ S311 | ||
17 | random.triangular() | ||
| | ||
|
||
S311.py:17:1: S311 Standard pseudo-random generators are not suitable for cryptographic purposes | ||
| | ||
15 | random.choices() | ||
16 | random.uniform() | ||
17 | random.triangular() | ||
| ^^^^^^^^^^^^^^^^^^^ S311 | ||
18 | | ||
19 | # Unrelated | ||
| |