flake8-bandit
Automated security testing with bandit and flake8.
What it is and what it does
flake8-bandit is a flake8 plugin that runs bandit security checks as part of your normal linting workflow. Instead of running bandit separately, you get security violations reported inline with your other flake8 issues, using 'S' prefixes (e.g., S101) rather than bandit's default 'B' codes to avoid conflicts with flake8-bugbear.
The plugin reads standard .bandit configuration files to let you exclude paths and select specific tests. If you already lint with flake8, adding this plugin means security testing happens automatically without changing your workflow—you just install it and run flake8 as normal.
Use it for:
- Catch common security issues like hardcoded credentials or insecure deserialization during routine code review without a separate bandit run.
- Enforce security standards in CI/CD by failing the flake8 check when security violations are detected.
- Configure which bandit tests to run per project using .bandit files, excluding test directories or third-party code from security scanning.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates bandit security checks into flake8 linting, reporting security issues as flake8 violations with 'S' prefixes instead of the default 'B' codes.
Yes, if you already use flake8 and want security checks integrated into your linting step. The low install friction and permissive license make it a straightforward addition. However, the dormant maintenance status (last release August 2022) means you should verify compatibility with your current flake8 and bandit versions before relying on it in production CI/CD.
Install
flake8-bandit on PyPI
pip
pip install flake8-bandituv
uv add flake8-banditpoetry
poetry add flake8-banditInstalling flake8-bandit
Before you install
Low install friction with only two runtime dependencies (flake8 and bandit). Maintenance is dormant—last release was 2022-08-29 and last commit 2023-09-13—so expect no active bug fixes or feature updates, though the repository remains unarchived.
License in practice
MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions—no legal barrier to adoption.
Quickstart
pip install flake8-bandit
# Then run flake8 as usual; security checks are automatically included
flake8 your_code.py
# Configure via .bandit file:
# [bandit]
# exclude = /tests
# tests: B101
Requires flake8 and bandit to be installed; Python >= 3.6.
Verify before relying
- Whether the package remains compatible with recent flake8 and bandit versions given the dormant maintenance status.
- Whether the 'S' prefix remapping still works correctly with current bandit releases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flake8, bandit |
| Maintenance | dormant — 1,446 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 532,017/month — #6,150 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_bandit-4.1.1-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
banditBandit scans Python code to identify common…
permissive · top 1,000 on PyPI
flake8-bugbearA flake8 plugin that detects likely bugs and…
permissive · top 5,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
dlintDlint is a flake8 plugin that adds…
permissive · top 15,000 on PyPI
flake8-pyiA Flake8 plugin that lints Python type stub…
permissive · top 5,000 on PyPI
flake8-htmlA flake8 plugin that converts code style…
permissive · top 15,000 on PyPI
wemake-python-styleguideA flake8 plugin that enforces strict,…
permissive · top 15,000 on PyPI
flake8-blackA flake8 plugin that runs black's code style…
permissive · top 15,000 on PyPI
flake8-import-orderA flake8 plugin that enforces import ordering…
copyleft · top 5,000 on PyPI
bandit-sarif-formatterConverts Bandit security analysis output into…
permissive · top 15,000 on PyPI