Static analysis
What is Bandit? An introduction to PyCQA's Python security linter
Bandit is a security linter from PyCQA that finds common security issues in Python code. It is free software released under the Apache license. It is aimed at Python developers.
- Tool
- Bandit
- Made by
- PyCQA
- Official site
- github.com/PyCQA/bandit
- Category
- Static analysis
Who makes Bandit
Bandit is maintained under PyCQA. It was originally developed in the OpenStack Security Project and later moved to PyCQA, where it lives today.
The official website is the project's GitHub repository, linked below.
Official website: github.com/PyCQA/bandit
What Bandit is for
Bandit is for finding common security issues in Python code. As a security linter, it reads your source and reports patterns that are likely to be security problems, rather than checking style or formatting.
It works by parsing each file into an abstract syntax tree (AST) and running plugins against the AST nodes. Once it has scanned all files, it generates a report. Because the checks are plugins operating on the tree, the AST node coverage can be extended.
Who Bandit is for
Bandit is for Python developers who want security checks on their code. It is free software under the Apache license, so it can be adopted by individual developers and by projects of any size.
Projects that use Bandit can also display a Bandit badge in their README, which signals to contributors and users that the code is checked.
Notable capabilities
Bandit is a focused tool. Its capabilities center on how it analyzes code and how it is distributed.
- Security checks for Python: it finds common security issues in Python code.
- AST-based analysis: each file is parsed into an AST, and plugins run against the AST nodes.
- Extensible coverage: the AST node coverage can be extended.
- Report generation: a report is produced after all files have been scanned.
- Container image distribution: it is distributed as a container image built with GitHub Actions and published on ghcr.io.
- Signed images: container images are signed with sigstore cosign so their origin can be verified.
- README badge: projects can display a Bandit badge in their README.
- Open licensing: it is free software under the Apache license.
How Bandit fits static analysis
Static analysis tools examine code without executing it. Bandit belongs to that group and specializes in security for a single language, Python. Where a general linter might enforce style or catch bugs, Bandit's plugins are concerned with security issues.
Its AST-based design is typical of static analysis: the code is parsed into a structure, and checks run over that structure. That makes it a natural companion to other linters in a Python project, each handling a different slice of code quality.
For Linthelm's focus on linters, static analysis and code quality, Bandit shows how security checking can be a lightweight addition to a development workflow. The signed container image on ghcr.io also offers a way to run it without installing it into a project environment, with the signature allowing the image's origin to be verified.
Frequently asked questions
What is Bandit used for?
Bandit is used to find common security issues in Python code. It parses each file into an AST, runs plugins against the nodes and generates a report after scanning all files.
Who develops Bandit?
Bandit is a security linter from PyCQA. It was originally developed in the OpenStack Security Project and later moved to PyCQA.
What license does Bandit use?
Bandit is free software under the Apache license.
Is there a container image for Bandit?
Yes. It is distributed as a container image built with GitHub Actions and published on ghcr.io. The images are signed with sigstore cosign so their origin can be verified.
Can Bandit be extended?
Yes. Its AST node coverage can be extended.
Linthelm is independent and is not affiliated with PyCQA. Product names belong to their owners. Features change; confirm details on the official website.