-
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.
Add remaining checks, refine tests based on bandit spec
- Loading branch information
Showing
15 changed files
with
363 additions
and
24 deletions.
There are no files selected for viewing
7 changes: 4 additions & 3 deletions
7
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S405.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from xml import etree # S405 | ||
import xml.etree as xmle # S405 | ||
import xml.etree # S405 | ||
import xml.etree.cElementTree # S405 | ||
from xml.etree import cElementTree # S405 | ||
import xml.etree.ElementTree # S405 | ||
from xml.etree import ElementTree # S405 |
2 changes: 0 additions & 2 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S407.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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
from xml.dom import expatbuilder # S407 | ||
from xml.sax import expatreader # S407 | ||
import xml.dom.expatbuilder # S407 | ||
import xml.sax.expatreader # S407 |
4 changes: 1 addition & 3 deletions
4
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S412.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 |
---|---|---|
@@ -1,3 +1 @@ | ||
import wsgiref.handlers # S412 | ||
from twisted.internet import reactor # S412 | ||
from twisted.web import static, server, twcgi # S412 | ||
from twisted.web.twcgi import CGIScript # S412 |
10 changes: 4 additions & 6 deletions
10
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S413.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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
from cryptography.hazmat import backends # S413 | ||
from cryptography.hazmat.primitives.asymmetric import dsa # S413 | ||
from cryptography.hazmat.primitives.asymmetric import ec # S413 | ||
from cryptography.hazmat.primitives.asymmetric import rsa # S413 | ||
from Crypto.PublicKey import RSA as pycrypto_rsa # S413 | ||
from Cryptodome.PublicKey import DSA as pycryptodomex_dsa # S413 | ||
import Crypto.Hash # S413 | ||
from Crypto.Hash import MD2 # S413 | ||
import Crypto.PublicKey # S413 | ||
from Crypto.PublicKey import RSA # S413 |
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
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
38 changes: 38 additions & 0 deletions
38
...rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S405_S405.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,38 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs | ||
--- | ||
S405.py:1:8: S405 `xml.etree` methods are vulnerable to XML attacks | ||
| | ||
1 | import xml.etree.cElementTree # S405 | ||
| ^^^^^^^^^^^^^^^^^^^^^^ S405 | ||
2 | from xml.etree import cElementTree # S405 | ||
3 | import xml.etree.ElementTree # S405 | ||
| | ||
|
||
S405.py:2:6: S405 `xml.etree` methods are vulnerable to XML attacks | ||
| | ||
1 | import xml.etree.cElementTree # S405 | ||
2 | from xml.etree import cElementTree # S405 | ||
| ^^^^^^^^^ S405 | ||
3 | import xml.etree.ElementTree # S405 | ||
4 | from xml.etree import ElementTree # S405 | ||
| | ||
|
||
S405.py:3:8: S405 `xml.etree` methods are vulnerable to XML attacks | ||
| | ||
1 | import xml.etree.cElementTree # S405 | ||
2 | from xml.etree import cElementTree # S405 | ||
3 | import xml.etree.ElementTree # S405 | ||
| ^^^^^^^^^^^^^^^^^^^^^ S405 | ||
4 | from xml.etree import ElementTree # S405 | ||
| | ||
|
||
S405.py:4:6: S405 `xml.etree` methods are vulnerable to XML attacks | ||
| | ||
2 | from xml.etree import cElementTree # S405 | ||
3 | import xml.etree.ElementTree # S405 | ||
4 | from xml.etree import ElementTree # S405 | ||
| ^^^^^^^^^ S405 | ||
| | ||
|
||
|
28 changes: 28 additions & 0 deletions
28
...rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S406_S406.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,28 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs | ||
--- | ||
S406.py:1:6: S406 `xml.sax` methods are vulnerable to XML attacks | ||
| | ||
1 | from xml import sax # S406 | ||
| ^^^ S406 | ||
2 | import xml.sax as xmls # S406 | ||
3 | import xml.sax # S406 | ||
| | ||
|
||
S406.py:2:8: S406 `xml.sax` methods are vulnerable to XML attacks | ||
| | ||
1 | from xml import sax # S406 | ||
2 | import xml.sax as xmls # S406 | ||
| ^^^^^^^^^^^^^^^ S406 | ||
3 | import xml.sax # S406 | ||
| | ||
|
||
S406.py:3:8: S406 `xml.sax` methods are vulnerable to XML attacks | ||
| | ||
1 | from xml import sax # S406 | ||
2 | import xml.sax as xmls # S406 | ||
3 | import xml.sax # S406 | ||
| ^^^^^^^ S406 | ||
| | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
...rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S407_S407.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,18 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs | ||
--- | ||
S407.py:1:6: S407 `xml.dom.expatbuilder` is vulnerable to XML attacks | ||
| | ||
1 | from xml.dom import expatbuilder # S407 | ||
| ^^^^^^^ S407 | ||
2 | import xml.dom.expatbuilder # S407 | ||
| | ||
|
||
S407.py:2:8: S407 `xml.dom.expatbuilder` is vulnerable to XML attacks | ||
| | ||
1 | from xml.dom import expatbuilder # S407 | ||
2 | import xml.dom.expatbuilder # S407 | ||
| ^^^^^^^^^^^^^^^^^^^^ S407 | ||
| | ||
|
||
|
Oops, something went wrong.