Aller au contenu

Bandit

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

Configuration

pyproject.toml
[tool.bandit]
exclude_dirs = ["venv"]
skips = [
    "B101", # assert_used
]

Utilisation

bandit -c pyproject.toml -r .

Utilisation avec pre-commit

.pre-commit-config.yaml
repos:
  - repo: https://github.com/PyCQA/bandit
    rev: 1.8.0
    hooks:
      - id: bandit
        args: ["-c", "pyproject.toml"]
        additional_dependencies: ["bandit[toml]"]

Ressources