From d17e6eb0befd79aba2a39b8258325a80c711a1c9 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 19 Nov 2026 11:59:32 +0100 Subject: [PATCH] chore: add bandit (static security analysis) to pre-commit Matches DIRAC's setup: configuration read from pyproject.toml, tests excluded. Clean run with no findings and no skips needed. Part of DIRACGrid/.github#5. --- .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 3 +++ 2 files changed, 10 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71a6ece..3fd979e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,10 @@ repos: - id: zizmor # Overrides the hook's own args, so keep its --no-progress (zizmor#582). args: ["--no-progress", "--no-online-audits"] + + # static security analysis + - repo: https://github.com/PyCQA/bandit + rev: '1.9.4' + hooks: + - id: bandit + args: ["-q", "-c", "pyproject.toml"] diff --git a/pyproject.toml b/pyproject.toml index da38a98..d833041 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,3 +50,6 @@ enable_error_code = ["import", "attr-defined"] [[tool.mypy.overrides]] module = 'sh.*' ignore_missing_imports = true + +[tool.bandit] +exclude_dirs = [".github", "docs", "test", "tests"]