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

Suggest fixes for issues #1001

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into suggest_fix
ericwb authored Oct 14, 2024
commit e6fa3d887db3ca99f8816ee7ba30cd6c8c63bfdb
19 changes: 0 additions & 19 deletions bandit/plugins/hashlib_insecure_functions.py
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@
""" # noqa: E501
import ast
import sys

import bandit
from bandit.core import issue
@@ -101,24 +100,6 @@ def _hashlib_func(context, func):
)


def _hashlib_new(context, func):
if func == "new":
args = context.call_args
keywords = context.call_keywords
name = args[0] if args else keywords.get("name", None)
if len(context.node.args):
context.node.args[0].value = "sha224"
if isinstance(name, str) and name.lower() in WEAK_HASHES:
return bandit.Issue(
severity=bandit.MEDIUM,
confidence=bandit.HIGH,
cwe=issue.Cwe.BROKEN_CRYPTO,
text=f"Use of insecure {name.upper()} hash function.",
lineno=context.node.lineno,
fix=context.unparse(context.node),
)


def _crypt_crypt(context, func):
args = context.call_args
keywords = context.call_keywords
You are viewing a condensed version of this merge commit. You can view the full changes here.