-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid flagging HTTP and HTTPS literals in urllib-open
- Loading branch information
1 parent
dda4ced
commit b90243b
Showing
4 changed files
with
145 additions
and
5 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S310.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,19 @@ | ||
import urllib | ||
|
||
urllib.urlopen(url='http://www.google.com') | ||
urllib.urlopen(url='http://www.google.com', **kwargs) | ||
urllib.urlopen('http://www.google.com') | ||
urllib.urlopen('file:///foo/bar/baz') | ||
urllib.urlopen(url) | ||
|
||
urllib.Request(url='http://www.google.com', **kwargs) | ||
urllib.Request(url='http://www.google.com') | ||
urllib.Request('http://www.google.com') | ||
urllib.Request('file:///foo/bar/baz') | ||
urllib.Request(url) | ||
|
||
urllib.URLopener().open(fullurl='http://www.google.com', **kwargs) | ||
urllib.URLopener().open(fullurl='http://www.google.com') | ||
urllib.URLopener().open('http://www.google.com') | ||
urllib.URLopener().open('file:///foo/bar/baz') | ||
urllib.URLopener().open(url) |
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
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
107 changes: 107 additions & 0 deletions
107
...rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S310_S310.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,107 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs | ||
--- | ||
S310.py:4:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
3 | urllib.urlopen(url='http://www.google.com') | ||
4 | urllib.urlopen(url='http://www.google.com', **kwargs) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 | ||
5 | urllib.urlopen('http://www.google.com') | ||
6 | urllib.urlopen('file:///foo/bar/baz') | ||
| | ||
|
||
S310.py:6:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
4 | urllib.urlopen(url='http://www.google.com', **kwargs) | ||
5 | urllib.urlopen('http://www.google.com') | ||
6 | urllib.urlopen('file:///foo/bar/baz') | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 | ||
7 | urllib.urlopen(url) | ||
| | ||
|
||
S310.py:7:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
5 | urllib.urlopen('http://www.google.com') | ||
6 | urllib.urlopen('file:///foo/bar/baz') | ||
7 | urllib.urlopen(url) | ||
| ^^^^^^^^^^^^^^^^^^^ S310 | ||
8 | | ||
9 | urllib.Request(url='http://www.google.com', **kwargs) | ||
| | ||
|
||
S310.py:9:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
7 | urllib.urlopen(url) | ||
8 | | ||
9 | urllib.Request(url='http://www.google.com', **kwargs) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 | ||
10 | urllib.Request(url='http://www.google.com') | ||
11 | urllib.Request('http://www.google.com') | ||
| | ||
|
||
S310.py:12:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
10 | urllib.Request(url='http://www.google.com') | ||
11 | urllib.Request('http://www.google.com') | ||
12 | urllib.Request('file:///foo/bar/baz') | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ S310 | ||
13 | urllib.Request(url) | ||
| | ||
|
||
S310.py:13:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
11 | urllib.Request('http://www.google.com') | ||
12 | urllib.Request('file:///foo/bar/baz') | ||
13 | urllib.Request(url) | ||
| ^^^^^^^^^^^^^^^^^^^ S310 | ||
14 | | ||
15 | urllib.URLopener().open(fullurl='http://www.google.com', **kwargs) | ||
| | ||
|
||
S310.py:15:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
13 | urllib.Request(url) | ||
14 | | ||
15 | urllib.URLopener().open(fullurl='http://www.google.com', **kwargs) | ||
| ^^^^^^^^^^^^^^^^^^ S310 | ||
16 | urllib.URLopener().open(fullurl='http://www.google.com') | ||
17 | urllib.URLopener().open('http://www.google.com') | ||
| | ||
|
||
S310.py:16:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
15 | urllib.URLopener().open(fullurl='http://www.google.com', **kwargs) | ||
16 | urllib.URLopener().open(fullurl='http://www.google.com') | ||
| ^^^^^^^^^^^^^^^^^^ S310 | ||
17 | urllib.URLopener().open('http://www.google.com') | ||
18 | urllib.URLopener().open('file:///foo/bar/baz') | ||
| | ||
|
||
S310.py:17:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
15 | urllib.URLopener().open(fullurl='http://www.google.com', **kwargs) | ||
16 | urllib.URLopener().open(fullurl='http://www.google.com') | ||
17 | urllib.URLopener().open('http://www.google.com') | ||
| ^^^^^^^^^^^^^^^^^^ S310 | ||
18 | urllib.URLopener().open('file:///foo/bar/baz') | ||
19 | urllib.URLopener().open(url) | ||
| | ||
|
||
S310.py:18:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
16 | urllib.URLopener().open(fullurl='http://www.google.com') | ||
17 | urllib.URLopener().open('http://www.google.com') | ||
18 | urllib.URLopener().open('file:///foo/bar/baz') | ||
| ^^^^^^^^^^^^^^^^^^ S310 | ||
19 | urllib.URLopener().open(url) | ||
| | ||
|
||
S310.py:19:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. | ||
| | ||
17 | urllib.URLopener().open('http://www.google.com') | ||
18 | urllib.URLopener().open('file:///foo/bar/baz') | ||
19 | urllib.URLopener().open(url) | ||
| ^^^^^^^^^^^^^^^^^^ S310 | ||
| | ||
|
||
|