Tool profilesBased on official documentation, not tested by us

Bandit: a free security linter that reads your Python code for common mistakes before you ship

Bandit is a free, open-source command-line tool that scans Python code for common security issues by reading its structure and running tests on it. Based on the official README, documentation and release notes, not tested by us: what it does, what it checks, its limits and what we could not confirm.

TypeStatic code analysis scanner for Python (command line)
Reviewed23 Nov 2026
Version1.9.4 (latest on the releases page we read on 23 Nov 2026; the date is not in the text we read)
License and cost

Free and open source (Apache License 2.0)

Best for

Founders and small teams who write Python, often with an AI assistant, and want a quick free check for risky patterns such as hardcoded passwords, shell commands built from text and unsafe file loading before each release.

Watch out for

It only reads Python and only finds the patterns its tests cover, so a clean report is not proof of safety. It also reports things that are fine in your case, so each finding needs a human decision.

← All tool profilesNo. 15 / 21

In one sentence

Bandit is a scanner for your own Python code. It reads each file, builds a map of its structure (an AST, short for abstract syntax tree) and runs a set of tests against it, then prints a report of anything that looks like a security problem. This kind of check is called static analysisStatic analysis (SAST) A tool that reads your source code without running it and flags patterns that often lead to security bugs, such as unsafe queries or hard-coded secrets. Tap again to open the glossary: it reads the code without running it.

Who it is for

People who write Python, especially with help from AI assistants, and want a cheap automatic review of what was generated before it ships. It is a command-line tool, so you need to be comfortable typing commands. It does not replace a human review, and it does not look at other languages.

What the documentation says

Everything below comes from the project's README, its documentation and its releases page, which we read on 23 November 2026.

  • What it is: the README calls it a security linter from PyCQA and says it was originally developed within the OpenStack Security Project and later moved to PyCQA. The documentation says it processes each file, builds an AST and runs the appropriate plugins against its nodes, then generates a report.
  • Licence: the README says free software under the Apache licence, and the documentation names the Apache License 2.0.
  • Install: pip install bandit, ideally inside a virtual environment. Optional extras add TOML configuration support (bandit[toml]), the baseline tool (bandit[baseline]) and SARIF output (bandit[sarif]). The README also lists a container image on ghcr.io, signed with sigstore cosign.
  • First scan: bandit -r path/to/your/code scans a folder and everything inside it.
  • Only show the serious ones: --severity-level=high or the short form -lll reports only high-severity issues, and -n 3 shows three lines of context.
  • Profiles and input: a profile such as ShellInjection runs only the tests listed in it, and Bandit can read code from standard input.
  • Baseline: you can save a report in JSON format and pass it back with -b, so that known issues you have accepted are ignored. The documentation gives a cleartext password in a unit test as an example.
  • Configuration: a .bandit file (INI) is read when you scan with -r; a YAML or TOML file, such as the [tool.bandit] section of pyproject.toml, is passed with -c. You can exclude folders and choose which tests to run or skip.
  • Silencing a finding: add # nosec to the line, or name the tests, for example # nosec B602, B607. The documentation recommends adding a comment that explains why the line was excluded.
  • Python versions: the FAQ says Bandit reads code with Python's own parser, so you should run it under the Python version your project targets. The release notes say version 1.9.0 added support for Python 3.14 and dropped the end-of-life Python 3.9.

What it checks

The documentation lists its tests as plugins with IDs. The groups are: B1xx miscellaneous, B2xx framework misconfigurationMisconfiguration A setting left wrong or at its default that exposes something, such as a storage bucket open to everyone or an admin page with no login. Tap again to open the glossary, B3xx and B4xx risky calls and imports, B5xx cryptography, B6xx injection and B7xx cross-site scripting. A few of them, as the documentation names them:

  • B105: a hardcoded password string. B106 and B107 cover passwords in function calls and default values.
  • B602: a subprocess call with shell=True. B608: SQL built as text.
  • B506: yaml.load, which can build arbitrary objects.
  • B501: a web request that does not verify the certificate.
  • B113: a web request without a timeout.
  • B201: Flask running with debug on.
  • B701: Jinja2 with autoescape off.
  • B101: use of assert.
  • B614 and B615, which concern AI work: torch.load and unsafe downloads from Hugging Face. The release notes say B614 was narrowed to torch.load in 1.9.3 and a B615 false alarm was fixed in 1.9.4.

The good

  • Free, open source and installed with one pip command.
  • One command scans a whole project and you can filter by severity.
  • Tests cover typical mistakes in code that AI assistants write: secretsSecret (API key, token, password) Any piece of text that proves to a service that you are allowed in, such as an API key, a database password or an access token. Tap again to open the glossary in the code, shell commands, unsafe loading of data and models, disabled certificate checks.
  • Baselines and # nosec with a test ID let a team accept what it has reviewed without silencing everything.
  • It can run in a build pipeline or as a pre-commit hook; the documentation shows a pre-commit setup.
  • The project publishes regular releases.

The limits it admits

  • It is a Python-only tool: the documentation describes finding common security issues in Python code.
  • It works on the code's structure, so the Python version you run it with matters: code written for a different version may fail to parse, as the FAQ explains.
  • The documentation itself says a flagged line may be a false positive or acceptable for another reason, which is why # nosec and baselines exist.
  • The documentation does not give a count of how many issues it finds on a real project, or a false-alarm rate.

When not to use it

  • If you think a clean report means your code is safe. It only finds what its tests cover.
  • For other languages. Pair it with a scanner that reads them.
  • To find vulnerable libraries. From what we read, Bandit checks your own code; for dependencies see our OSV-Scanner profile.
  • As your only check. Review, tests and dependency scanning still matter.

What it costs you

Time more than money. The documentation gives no estimate of setup time. The real work is deciding what to fix and what to accept, tuning out false alarms with a configuration file or # nosec, and adding the scan to your build. We have not measured any of this.

Typical setup mistakes

  • Scanning once and forgetting. Run it on every change, ideally in your build pipeline.
  • Silencing without a reason. A bare # nosec hides every issue on that line, including ones added later. Name the test and write why.
  • Skipping whole test IDs to make the report shorter. You lose the check everywhere.
  • Running it under a different Python version than your project. Code can fail to parse.
  • Treating the report as a score. A short report is not a safe app.
  • Pasting secrets into an online tool or an AI chat to "check" a finding. Keep keys out of prompts.

How to check that it works

Once you try it, in a test folder with fake data: write a small file with a risky line on purpose, such as a fake password in a variable and a subprocess call with shell=True, run Bandit on the folder and confirm that each risky line is reported. If one is not, find out why before trusting the tool. Never test with real keys or on a production system. We have not run this ourselves yet.

Where to start

A short path, from the official getting-started page (not tested by us):

  1. Create a virtual environment and activate it, then install with pip install bandit.
  2. Scan a project folder with bandit -r path/to/your/code.
  3. Narrow it to the serious findings with bandit -r path/to/your/code --severity-level=high.
  4. For each finding, fix it or accept it with a # nosec that names the test and explains why.
  5. When you are happy, add it to your build or to a pre-commit hook.

Official documentation for everything else: httpsHTTPS The secure version of the web address protocol: it encrypts what travels between a visitor and your site and checks that the site is the real one. Tap again to open the glossary://bandit.readthedocs.io/en/latest/

What we could not confirm

We did not install or run Bandit, so we cannot say how many findings or false alarms it gives on a real project, how fast it is on a large codebase, or how it behaves on Windows. We did not read the page on the report formats, the list of blacklisted calls and imports or the continuous-integration page, and the date of version 1.9.4 was not in the text we read. We do not know how it compares with other scanners.

Sources

Follow us

New profiles and security news: YouTube (@safet2ship) and Instagram (@safet2ship).

YouTube channel · Instagram

More tool profiles

Same topic first, then the newest.

All tool profiles
Vulnerability scansOfficial docs

BLA (Blind LLM Agents)

A free shield that makes it costly for an AI agent to reverse-engineer your software, not impossible

Best forDevelopers and small teams who ship a client-side app, an Electron app, a WASM module or a local model and worry that an AI agent can read it and copy it in minutes.

Reviewed 24 Nov 2026
Vulnerability scansOfficial docs

ZAP

A free scanner that looks for security holes in a web app you are building

Best forA founder or developer who wants to check their own web app or API for common holes before launch, on a test copy.

Reviewed 16 Nov 2026
Vulnerability scansOfficial docs

Lynis

A free audit that checks a Linux server's security settings and tells you what to fix

Best forAnyone who runs their own Linux server and wants a checklist of settings to tighten, without a network scan.

Reviewed 9 Nov 2026

Our own free checks

Small tools we built: they run in your browser and store nothing.

All our tools
Before you launchPaste an address

Website security check

Paste your site address and get a grade, a plain-language report and copy-paste fixes for HTTPS, security headers and cookies.

FreeOpen the tool
Before you launchYour file, in your browser

Keys-in-your-code check

Find API keys and secrets that your app exposes in public files. Built for apps made with AI.

FreeOpen the tool
What you leakYour file, in your browser

Metadata check

See what hidden data your photos, PDFs and Office files carry (author, software, dates, GPS location) before you share them. Runs in your browser.

FreeOpen the tool
What you leakChecklist

Exposure check

A self-check of what your company leaks in public (files, email records, accounts, repositories), with links to the tool for each point.

FreeOpen the tool
Newsletter · every Friday · free

Get the weekly security briefing

One email every Friday: what to act on now and what to plan this week, in plain words. The free one-page runbooks come in your welcome email. You confirm your address first.

Subscribe for free

Press / to search from any page