Skip to content

Commit 1ed10e2

Browse files
update bandit config
1 parent 9976434 commit 1ed10e2

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/bandit.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# Bandit is a security linter designed to find common security issues in Python code.
77
# This action will run Bandit on your codebase.
88
# The results of the scan will be found under the Security tab of your repository.
9+
#
10+
# Configuration: This workflow uses pyproject.toml for centralized security settings.
11+
# Local development: make security (uses pyproject.toml)
12+
# CI/CD: This workflow (uses pyproject.toml via ini_path)
913

1014
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname
1115
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA
@@ -38,14 +42,11 @@ jobs:
3842
# Github token of the repository (automatically created by Github)
3943
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
4044
# File or directory to run bandit on
41-
# path: # optional, default is .
45+
path: archipy/ # Scan the archipy directory (matches local make security command)
4246
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
4347
# level: # optional, default is UNDEFINED
4448
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
4549
# confidence: # optional, default is UNDEFINED
46-
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
47-
excluded_paths: "features,docs,scripts"
48-
# comma-separated list of test IDs to skip
49-
# skips: # optional, default is DEFAULT
50+
# Exclusions and skips are now configured in pyproject.toml for centralized management
5051
# path to a .bandit file that supplies command line arguments
51-
# ini_path: # optional, default is DEFAULT
52+
ini_path: pyproject.toml # Use pyproject.toml configuration for centralized security settings

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ lint: ## Run all linters
7272
.PHONY: security
7373
security: ## Run security scan with Bandit
7474
@echo "${BLUE}Running security scan...${NC}"
75-
$(PYTHON) bandit -r archipy/ -s B101,B301,B403 -x features,docs,scripts -f json -o bandit-report.json || true
75+
$(PYTHON) bandit -c pyproject.toml -r archipy/ -f json -o bandit-report.json || true
7676

7777
.PHONY: behave
7878
behave: ## Run tests with behave

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,19 @@ pyproject_root_var = "pyproject"
335335
[tool.codespell]
336336
ignore-words-list = "exat,convertor"
337337
skip = ".git,__pycache__,build,dist"
338+
339+
[tool.bandit]
340+
# Bandit configuration for security scanning
341+
# https://bandit.readthedocs.io/en/latest/config.html
342+
343+
# Target directories to scan
344+
targets = ["archipy"]
345+
346+
# Exclude directories from scanning
347+
exclude_dirs = ["features", "docs", "scripts"]
348+
349+
# Skip specific test IDs
350+
# B101: assert_used - Allow assert statements in tests
351+
# B301: pickle - Allow pickle usage (needed for some serialization)
352+
# B403: import_pickle - Allow pickle imports
353+
skips = ["B101", "B301", "B403"]

0 commit comments

Comments
 (0)