Repository Analysis

PyCQA/bandit

Bandit is a tool designed to find common security issues in Python code.

12.1 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of PyCQA/bandit, a Python project with 8,162 GitHub stars. SynthScan v2.0 examined 27,330 lines of code across 218 source files, recording 270 pattern matches distributed across 12 syntactic categories. The overall adjusted score of 12.1 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

12.1
Adjusted Score
12.1
Raw Score
100%
Time Factor
2026-07-13
Last Push
8.2K
Stars
Python
Language
27.3K
Lines of Code
218
Files
270
Pattern Hits
2026-07-14
Scan Date
0.05
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 11MEDIUM 10LOW 249

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 270 distinct pattern matches across 12 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers151 hits · 152 pts
SeverityFileLineSnippetContext
LOWCONTRIBUTING.md226 def prohibit_unsafe_deserialization(context):CODE
LOWtests/unit/core/test_issue.py54 def test_issue_filter_severity(self):CODE
LOWtests/unit/core/test_issue.py65 def test_issue_filter_confidence(self):CODE
LOWtests/unit/core/test_util.py100 def test_get_module_qualname_from_path_abs_typical(self):CODE
LOWtests/unit/core/test_util.py110 def test_get_module_qualname_from_path_with_dot(self):CODE
LOWtests/unit/core/test_util.py119 def test_get_module_qualname_from_path_abs_missingmid(self):CODE
LOWtests/unit/core/test_util.py141 def test_get_module_qualname_from_path_abs_syms(self):CODE
LOWtests/unit/core/test_util.py151 def test_get_module_qualname_from_path_rel_typical(self):CODE
LOWtests/unit/core/test_util.py161 def test_get_module_qualname_from_path_rel_missingmid(self):CODE
LOWtests/unit/core/test_util.py193 def test_get_module_qualname_from_path_rel_syms(self):CODE
LOWtests/unit/core/test_util.py202 def test_get_module_qualname_from_path_sys(self):CODE
LOWtests/unit/core/test_util.py212 def test_get_module_qualname_from_path_invalid_path(self):CODE
LOWtests/unit/core/test_util.py218 def test_get_module_qualname_from_path_dir(self):CODE
LOWtests/unit/core/test_util.py280 def test_path_for_function_no_file(self):CODE
LOWtests/unit/core/test_util.py283 def test_path_for_function_no_module(self):CODE
LOWtests/unit/core/test_util.py286 def test_escaped_representation_simple(self):CODE
LOWtests/unit/core/test_util.py290 def test_escaped_representation_valid_not_printable(self):CODE
LOWtests/unit/core/test_util.py294 def test_escaped_representation_invalid(self):CODE
LOWtests/unit/core/test_util.py298 def test_escaped_representation_mixed(self):CODE
LOWtests/unit/core/test_util.py29 def _setup_get_module_qualname_from_path(self):CODE
LOWtests/unit/core/test_util.py130 def test_get_module_qualname_from_path_abs_missingend(self):CODE
LOWtests/unit/core/test_util.py177 def test_get_module_qualname_from_path_rel_missingend(self):CODE
LOWtests/unit/core/test_util.py231 def test_namespace_path_split(self):CODE
LOWtests/unit/core/test_util.py338 def test_check_ast_node_bad_node(self):CODE
LOWtests/unit/core/test_util.py341 def test_check_ast_node_bad_type(self):CODE
LOWtests/unit/core/test_blacklisting.py23 def test_report_issue_defaults(self):CODE
LOWtests/unit/core/test_config.py192 def test_converted_blacklist_call_data(self):STRING
LOWtests/unit/core/test_config.py208 def test_converted_blacklist_import_data(self):STRING
LOWtests/unit/core/test_config.py223 def test_converted_blacklist_call_test(self):STRING
LOWtests/unit/core/test_config.py229 def test_converted_blacklist_import_test(self):STRING
LOWtests/unit/core/test_config.py235 def test_converted_exclude_blacklist(self):STRING
LOWtests/unit/core/test_context.py61 def test_call_function_name_qual(self):CODE
LOWtests/unit/core/test_context.py117 def test_function_def_defaults_qual(self, get_qual_attr):CODE
LOWtests/unit/core/test_context.py173 def test_check_call_arg_value(self, call_keywords):CODE
LOWtests/unit/core/test_context.py190 def test_get_lineno_for_call_arg(self, node):CODE
LOWtests/unit/core/test_context.py204 def test_get_call_arg_at_position(self):CODE
LOWtests/unit/core/test_context.py222 def test_is_module_being_imported(self):CODE
LOWtests/unit/core/test_context.py231 def test_is_module_imported_exact(self):CODE
LOWtests/unit/core/test_context.py240 def test_is_module_imported_like(self):CODE
LOWtests/unit/core/test_manager.py49 def test_create_manager_with_profile(self):CODE
LOWtests/unit/core/test_manager.py130 def test_populate_baseline_success(self):CODE
LOWtests/unit/core/test_manager.py171 def test_populate_baseline_invalid_json(self, mock_logger_warning):STRING
LOWtests/unit/core/test_manager.py195 def test_output_results_invalid_format(self):CODE
LOWtests/unit/core/test_manager.py209 def test_output_results_valid_format(self):CODE
LOWtests/unit/core/test_manager.py224 def test_discover_files_recurse_skip(self, isdir):CODE
LOWtests/unit/core/test_manager.py231 def test_discover_files_recurse_files(self, isdir):CODE
LOWtests/unit/core/test_manager.py240 def test_discover_files_exclude(self, isdir):CODE
LOWtests/unit/core/test_manager.py249 def test_discover_files_exclude_dir(self, isdir):CODE
LOWtests/unit/core/test_manager.py276 def test_discover_files_exclude_cmdline(self, isdir):CODE
LOWtests/unit/core/test_manager.py287 def test_discover_files_exclude_glob(self, isdir):CODE
LOWtests/unit/core/test_manager.py296 def test_discover_files_include(self, isdir):CODE
LOWtests/unit/core/test_manager.py304 def test_run_tests_keyboardinterrupt(self):CODE
LOWtests/unit/core/test_manager.py364 def test_find_candidate_matches(self):CODE
LOWtests/unit/core/test_test_set.py82 def test_profile_include_none(self):CODE
LOWtests/unit/core/test_test_set.py87 def test_profile_exclude_none(self):CODE
LOWtests/unit/core/test_test_set.py92 def test_profile_has_builtin_blacklist(self):CODE
LOWtests/unit/core/test_test_set.py98 def test_profile_exclude_builtin_blacklist(self):CODE
LOWtests/unit/core/test_test_set.py105 def test_profile_exclude_builtin_blacklist_specific(self):CODE
LOWtests/unit/core/test_test_set.py112 def test_profile_filter_blacklist_none(self):CODE
LOWtests/unit/core/test_test_set.py120 def test_profile_filter_blacklist_one(self):CODE
91 more matches not shown…
Cross-File Repetition10 hits · 50 pts
SeverityFileLineSnippetContext
HIGHbandit/formatters/html.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/xml.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/sarif.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/yaml.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/csv.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/text.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/formatters/json.py0prints discovered issues in the text format :param manager: the bandit manager object :param fileobj: the output file obSTRING
HIGHbandit/cli/baseline.py0bandit is a tool designed to find common security issues in python code.STRING
HIGHbandit/cli/config_generator.py0bandit is a tool designed to find common security issues in python code.STRING
HIGHbandit/cli/main.py0bandit is a tool designed to find common security issues in python code.STRING
Unused Imports38 hits · 38 pts
SeverityFileLineSnippetContext
LOWbandit/__init__.py7CODE
LOWbandit/__init__.py8CODE
LOWbandit/__init__.py9CODE
LOWbandit/__init__.py10CODE
LOWbandit/__init__.py11CODE
LOWbandit/__init__.py12CODE
LOWbandit/__init__.py13CODE
LOWbandit/__init__.py14CODE
LOWbandit/__init__.py15CODE
LOWbandit/__init__.py16CODE
LOWbandit/__init__.py17CODE
LOWbandit/core/__init__.py5CODE
LOWbandit/core/__init__.py6CODE
LOWbandit/core/__init__.py7CODE
LOWbandit/core/__init__.py8CODE
LOWbandit/core/__init__.py9CODE
LOWbandit/core/__init__.py10CODE
LOWbandit/core/__init__.py11CODE
LOWbandit/core/__init__.py12CODE
LOWbandit/core/__init__.py13CODE
LOWbandit/core/__init__.py14CODE
LOWbandit/core/__init__.py15CODE
LOWexamples/imports-from.py1CODE
LOWexamples/imports-from.py3CODE
LOWexamples/imports-from.py4CODE
LOWexamples/imports-from.py5CODE
LOWexamples/imports-from.py6CODE
LOWexamples/imports-from.py7CODE
LOWexamples/ciphers.py16CODE
LOWexamples/sql_statements.py1CODE
LOWexamples/imports.py1CODE
LOWexamples/imports.py2CODE
LOWexamples/imports.py3CODE
LOWexamples/imports.py4CODE
LOWexamples/xml_xmlrpc.py1CODE
LOWexamples/sql_multiline_statements.py1CODE
LOWexamples/eval.py1CODE
LOWexamples/imports-aliases.py7CODE
Deep Nesting29 hits · 29 pts
SeverityFileLineSnippetContext
LOWtests/functional/test_functional.py87CODE
LOWbandit/core/metrics.py88CODE
LOWbandit/core/tester.py26CODE
LOWbandit/core/config.py26CODE
LOWbandit/core/blacklisting.py21CODE
LOWbandit/core/context.py175CODE
LOWbandit/core/docs_utils.py8CODE
LOWbandit/core/node_visitor.py238CODE
LOWbandit/core/manager.py200CODE
LOWbandit/core/manager.py261CODE
LOWbandit/core/manager.py301CODE
LOWbandit/plugins/hashlib_insecure_functions.py56CODE
LOWbandit/plugins/injection_sql.py87CODE
LOWbandit/plugins/general_bad_file_permissions.py74CODE
LOWbandit/plugins/injection_shell.py81CODE
LOWbandit/plugins/injection_shell.py110CODE
LOWbandit/plugins/django_xss.py85CODE
LOWbandit/plugins/django_xss.py132CODE
LOWbandit/plugins/django_xss.py194CODE
LOWbandit/plugins/django_xss.py28CODE
LOWbandit/plugins/django_sql_injection.py22CODE
LOWbandit/plugins/ssh_no_host_key_verification.py47CODE
LOWbandit/plugins/injection_wildcard.py113CODE
LOWbandit/plugins/insecure_ssl_tls.py34CODE
LOWbandit/plugins/general_hardcoded_password.py30CODE
LOWbandit/plugins/jinja2_templates.py75CODE
LOWbandit/cli/config_generator.py142CODE
LOWbandit/cli/main.py46CODE
LOWbandit/cli/main.py134CODE
Excessive Try-Catch Wrapping21 hits · 28 pts
SeverityFileLineSnippetContext
LOWbandit/core/tester.py120 except Exception as e:CODE
LOWbandit/core/utils.py72 except Exception:CODE
LOWbandit/core/manager.py101 except Exception as e:CODE
LOWbandit/core/manager.py194 except Exception as e:CODE
LOWbandit/core/manager.py332 except Exception as e:CODE
MEDIUMbandit/core/manager.py301def _parse_file(self, fname, fdata, new_files_list):CODE
LOWbandit/plugins/try_except_pass.py22 except Exception:CODE
LOWbandit/plugins/try_except_continue.py23 except Exception:CODE
LOWbandit/cli/config_generator.py197 except Exception as e:CODE
LOWexamples/mark_safe_insecure.py20 except Exception:CODE
LOWexamples/mark_safe_insecure.py28 except Exception:CODE
LOWexamples/mark_safe_insecure.py37 except Exception:CODE
LOWexamples/mark_safe_insecure.py48 except Exception:CODE
MEDIUMexamples/mark_safe_insecure.py17def try_insecure(cls='" onload="alert(\'xss\')'):CODE
MEDIUMexamples/mark_safe_insecure.py25def except_insecure(cls='" onload="alert(\'xss\')'):CODE
MEDIUMexamples/mark_safe_insecure.py33def try_else_insecure(cls='" onload="alert(\'xss\')'):CODE
MEDIUMexamples/mark_safe_insecure.py44def finally_insecure(cls='" onload="alert(\'xss\')'):CODE
LOWexamples/try_except_pass.py11except Exception:CODE
LOWexamples/try_except_continue.py13 except Exception:CODE
LOWexamples/mark_safe_secure.py23 except Exception:CODE
MEDIUMexamples/mark_safe_secure.py20def try_secure():CODE
Redundant / Tautological Comments12 hits · 12 pts
SeverityFileLineSnippetContext
LOWbandit/plugins/django_xss.py201 # Check if the var are secureCOMMENT
LOWbandit/plugins/trojansource.py22 4 if access_level != 'none‮⁦': # Check if admin ⁩⁦' and access_level != 'userCODE
LOWbandit/plugins/huggingface_unsafe_download.py77 # Check if any HuggingFace-related modules are importedSTRING
LOWbandit/plugins/huggingface_unsafe_download.py84 # Check if any HF modules are importedSTRING
LOWbandit/plugins/huggingface_unsafe_download.py133 # Check if a revision or commit_id is specifiedSTRING
LOWbandit/plugins/huggingface_unsafe_download.py137 # Check if it's a secure revision (looks like a commit hash)STRING
LOWbandit/plugins/huggingface_unsafe_download.py143 # Check if it looks like a commit hash (hexadecimal string)STRING
LOWbandit/plugins/jinja2_templates.py106 # Check if select_autoescape function is used.STRING
LOWbandit/cli/main.py430 # Check if `--msg-template` is not present without custom formatterCOMMENT
LOWbandit/cli/main.py434 # Check if confidence or severity level have been specified with stringsCOMMENT
LOWexamples/trojansource.py4if access_level != 'none‮⁦': # Check if admin ⁩⁦' and access_level != 'userCODE
LOWexamples/trojansource_latin1.py6if access_level != 'none??': # Check if admin ??' and access_level != 'userCODE
Decorative Section Separators2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMexamples/huggingface_unsafe_download.py96# -------------------------------COMMENT
MEDIUMexamples/huggingface_unsafe_download.py98# -------------------------------COMMENT
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHexamples/subprocess_shell.py43subprocess.Popen('/bin/ls && cat /etc/passwd', shell=True)CODE
AI Slop Vocabulary2 hits · 4 pts
SeverityFileLineSnippetContext
LOWbandit/core/utils.py74 # qualified name for an attr, just return its base name.COMMENT
MEDIUMbandit/cli/main.py99 # Certainly a value is passed to command lineCOMMENT
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMexamples/long_set.py1# This file contains a single long_set with 7276 'a' elementsCOMMENT
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWbandit/cli/baseline.py1#COMMENT
LOWbandit/cli/config_generator.py21# '{cli}'COMMENT
AI Structural Patterns1 hit · 1 pts
SeverityFileLineSnippetContext
LOWbandit/core/issue.py80CODE