forked from PyCQA/bandit
-
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.
Add support for Python 3.9 (PyCQA#650)
* Add support for Python 3.9 Add GitHub Action unit testing of Python 3.9 and add to our supported list of Python versions. This patch also fixes some Py39 related issues. Namely: * A hardcoded password such as d["password"] = "blerg" in examples/hardcoded-passwords.py goes undetected. This is due to a change in behavior of the Py3.9 AST. * The README does match the output of bandit -h. Specially the targets is now [targets ...] instead of [targets [targets ...]]. This was introduced with Python fix: https://bugs.python.org/issue38438. As a result, the README no longer contains output of -h and the unit test to make sure they match is gone. Signed-off-by: Eric Brown <browne@vmware.com> * Update general_hardcoded_password.py Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
- Loading branch information
1 parent
1f759ab
commit 753d805
Showing
6 changed files
with
63 additions
and
173 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,58 @@ | ||
# Possible hardcoded password: 'Admin' | ||
# Severity: Low Confidence: Medium | ||
def someFunction(user, password="Admin"): | ||
print("Hi " + user) | ||
|
||
def someFunction2(password): | ||
# Possible hardcoded password: 'root' | ||
# Severity: Low Confidence: Medium | ||
if password == "root": | ||
print("OK, logged in") | ||
|
||
def noMatch(password): | ||
# Possible hardcoded password: '' | ||
# Severity: Low Confidence: Medium | ||
if password == '': | ||
print("No password!") | ||
|
||
def NoMatch2(password): | ||
# Possible hardcoded password: 'ajklawejrkl42348swfgkg' | ||
# Severity: Low Confidence: Medium | ||
if password == "ajklawejrkl42348swfgkg": | ||
print("Nice password!") | ||
|
||
# Possible hardcoded password: 'blerg' | ||
# Severity: Low Confidence: Medium | ||
def doLogin(password="blerg"): | ||
pass | ||
|
||
def NoMatch3(a, b): | ||
pass | ||
|
||
# Possible hardcoded password: 'blerg' | ||
# Severity: Low Confidence: Medium | ||
doLogin(password="blerg") | ||
|
||
# Possible hardcoded password: 'blerg' | ||
# Severity: Low Confidence: Medium | ||
password = "blerg" | ||
|
||
# Possible hardcoded password: 'blerg' | ||
# Severity: Low Confidence: Medium | ||
d["password"] = "blerg" | ||
|
||
# Possible hardcoded password: 'secret' | ||
# Severity: Low Confidence: Medium | ||
EMAIL_PASSWORD = "secret" | ||
|
||
# Possible hardcoded password: 'emails_secret' | ||
# Severity: Low Confidence: Medium | ||
email_pwd = 'emails_secret' | ||
|
||
# Possible hardcoded password: 'd6s$f9g!j8mg7hw?n&2' | ||
# Severity: Low Confidence: Medium | ||
my_secret_password_for_email = 'd6s$f9g!j8mg7hw?n&2' | ||
|
||
# Possible hardcoded password: '1234' | ||
# Severity: Low Confidence: Medium | ||
passphrase='1234' |
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