Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
aa8a8e8
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 19, 2026
862ed22
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 19, 2026
95d6300
Merge branch 'main' into pre-commit-ci-update-config
ericwb Feb 23, 2026
b261eab
Remove unnecessary blank line in calls.py
ericwb Feb 23, 2026
0b9afb4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
eefeda9
Remove unnecessary blank line in imports.py
ericwb Feb 23, 2026
3b742c7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
1238ec3
Remove unnecessary blank line in baseline.py
ericwb Feb 23, 2026
e86e5d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
0f341e6
Remove empty line at the start of config_generator.py
ericwb Feb 23, 2026
f88bdf7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
aa2dd19
Remove unnecessary blank line in main.py
ericwb Feb 23, 2026
d16edb8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
bf18734
Remove unnecessary blank line in csv.py
ericwb Feb 23, 2026
7638708
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
04c47d0
Remove unnecessary whitespace in custom.py
ericwb Feb 23, 2026
e140512
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
3b37856
Remove unnecessary blank line in html.py
ericwb Feb 23, 2026
5c42aae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
fc7aed0
Remove unnecessary blank line in json.py
ericwb Feb 23, 2026
88ffe73
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
c4e791d
Remove unnecessary blank line in sarif.py
ericwb Feb 23, 2026
1128103
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
da09c3e
Remove unnecessary blank line in screen.py
ericwb Feb 23, 2026
2891eed
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
b8536c3
Remove unnecessary blank line in text.py
ericwb Feb 23, 2026
2d24484
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
d1ad305
Remove unnecessary empty line in utils.py
ericwb Feb 23, 2026
7faf3ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
5f692e3
Remove unnecessary blank line in calls.py
ericwb Feb 23, 2026
3b2066d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
c0b2b1a
Remove empty line in imports.py
ericwb Feb 23, 2026
3b5dab9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
54ba5d2
Remove unnecessary blank line in baseline.py
ericwb Feb 23, 2026
b7ee10c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
3bcb8b4
Remove blank line at the beginning of config_generator.py
ericwb Feb 23, 2026
29e4a1c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
74c7ab6
Remove unnecessary blank line in main.py
ericwb Feb 23, 2026
736f7b2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2026
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: reorder-python-imports
args: [--application-directories, '.:src', --py38-plus]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
args: [--line-length=79, --target-version=py38]
Expand Down
1 change: 1 addition & 0 deletions bandit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

https://bandit.readthedocs.io/
"""

from bandit.cli import main

main.main()
1 change: 1 addition & 0 deletions bandit/blacklists/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
+------+---------------------+------------------------------------+-----------+

"""

from bandit.blacklists import utils
from bandit.core import issue

Expand Down
1 change: 1 addition & 0 deletions bandit/blacklists/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
+------+---------------------+------------------------------------+-----------+

"""

from bandit.blacklists import utils
from bandit.core import issue

Expand Down
1 change: 1 addition & 0 deletions bandit/cli/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# reports on any new findings.
# #############################################################################
"""Bandit is a tool designed to find common security issues in Python code."""

import argparse
import contextlib
import logging
Expand Down
1 change: 1 addition & 0 deletions bandit/cli/config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0
"""Bandit is a tool designed to find common security issues in Python code."""

import argparse
import importlib
import logging
Expand Down
7 changes: 3 additions & 4 deletions bandit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: Apache-2.0
"""Bandit is a tool designed to find common security issues in Python code."""

import argparse
import fnmatch
import logging
Expand Down Expand Up @@ -393,8 +394,7 @@ def main():
blacklist_info.append(f"{b['id']}\t{b['name']}")

plugin_list = "\n\t".join(sorted(set(plugin_info + blacklist_info)))
dedent_text = textwrap.dedent(
"""
dedent_text = textwrap.dedent("""
CUSTOM FORMATTING
-----------------

Expand All @@ -421,8 +421,7 @@ def main():

The following tests were discovered and loaded:
-----------------------------------------------
"""
)
""")
parser.epilog = dedent_text + f"\t{plugin_list}"

# setup work - parse arguments, and initialize BanditManager
Expand Down
4 changes: 2 additions & 2 deletions bandit/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_module_qualname_from_path(path):
:return: fully qualified module name
"""

(head, tail) = os.path.split(path)
head, tail = os.path.split(path)
if head == "" or tail == "":
raise InvalidModulePath(
f'Invalid python file path: "{path}" Missing path or file name'
Expand All @@ -145,7 +145,7 @@ def get_module_qualname_from_path(path):
qname = [os.path.splitext(tail)[0]]
while head not in ["/", ".", ""]:
if os.path.isfile(os.path.join(head, "__init__.py")):
(head, tail) = os.path.split(head)
head, tail = os.path.split(head)
qname.insert(0, tail)
else:
break
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
New field `CWE` added to output

"""

# Necessary for this formatter to work when imported on Python 2. Importing
# the standard library's csv module conflicts with the name of this module.
import csv
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
New field `CWE` added to output

"""

import logging
import os
import re
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
New field `CWE` added to output

"""

import logging
import sys
from html import escape as html_escape
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
New field `CWE` added to output

"""

# Necessary so we can import the standard library json module while continuing
# to name this file json.py. (Python 2 only)
import datetime
Expand Down
3 changes: 2 additions & 1 deletion bandit/formatters/sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
.. versionadded:: 1.7.8

""" # noqa: E501

import datetime
import logging
import pathlib
Expand Down Expand Up @@ -206,7 +207,7 @@ def add_skipped_file_notifications(skips, invocation):
invocation.tool_configuration_notifications = []

for skip in skips:
(file_name, reason) = skip
file_name, reason = skip

notification = om.Notification(
level="error",
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
New field `CWE` added to output

"""

import datetime
import logging
import sys
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
New field `CWE` added to output

"""

import datetime
import logging
import sys
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0
"""Utility functions for formatting plugins for Bandit."""

import io


Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
New field `CWE` added to output

"""

import logging
import sys
from xml.etree import ElementTree as ET # nosec: B405
Expand Down
1 change: 1 addition & 0 deletions bandit/formatters/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
New field `CWE` added to output

"""

# Necessary for this formatter to work when imported on Python 2. Importing
# the standard library's yaml module conflicts with the name of this module.
import datetime
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/app_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
CWE information added

""" # noqa: E501

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
CWE information added

"""

import fnmatch

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/crypto_request_no_cert_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
Added check for httpx module

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/general_bad_file_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
Added checks for S_IWGRP and S_IXOTH

""" # noqa: E501

import stat

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/general_bind_all_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/general_hardcoded_tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
CWE information added

""" # noqa: E501

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/hashlib_insecure_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
Added check for the crypt module weak hashes

""" # noqa: E501

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/huggingface_unsafe_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
.. versionadded:: 1.8.6

"""

import ast
import string

Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/injection_paramiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/injection_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
Flag when str.replace is used in the string construction

""" # noqa: E501

import ast
import re

Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/injection_wildcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/jinja2_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
CWE information added

"""

import ast

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/logging_config_insecure_listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
.. versionadded:: 1.7.5

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/mako_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/markupsafe_markup_xss.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
.. versionadded:: 1.8.3

"""

import ast

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/pytorch_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
.. versionadded:: 1.7.10

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/request_without_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
Added check for httpx module

""" # noqa: E501

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/ssh_no_host_key_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
CWE information added

"""

import ast

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/tarfile_unsafe_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
Added check for filter parameter

"""

import ast

import bandit
Expand Down
2 changes: 1 addition & 1 deletion bandit/plugins/trojansource.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
.. versionadded:: 1.7.10

""" # noqa: E501

from tokenize import detect_encoding

import bandit
from bandit.core import issue
from bandit.core import test_properties as test


BIDI_CHARACTERS = (
"\u202a",
"\u202b",
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/try_except_continue.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class (or no type). To accommodate this, the test may be configured to ignore
CWE information added

"""

import ast

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/try_except_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class (or no type). To accommodate this, the test may be configured to ignore
CWE information added

"""

import ast

import bandit
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/weak_cryptographic_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 1 addition & 0 deletions bandit/plugins/yaml_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
CWE information added

"""

import bandit
from bandit.core import issue
from bandit.core import test_properties as test
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import setuptools


data_files = []
man_path = "doc/build/man/bandit.1"
if os.path.isfile(man_path):
Expand Down
Loading
Loading