Skip to content

Commit 4a2d93d

Browse files
authored
#17: Add vulnerability scanner (#19)
* Add pre-commit pip-audit hook * Delete safety * Add pip-audit Github Action step
1 parent 1894530 commit 4a2d93d

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

{{cookiecutter.project_name}}/.github/workflows/pr.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ jobs:
2222

2323
- name: Spell Check
2424
uses: crate-ci/typos@master
25+
26+
- name: Check project dependencies for vulnerabilities
27+
uses: pypa/[email protected]
28+
with:
29+
vulnerability-service: osv

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ repos:
66
rev: v1.24.1
77
hooks:
88
- id: typos
9+
- repo: https://github.com/pypa/pip-audit
10+
rev: v2.7.3
11+
hooks:
12+
- id: pip-audit
13+
args: ["--vulnerability-service", "osv", "--cache-dir", ".pip_audit_cache"]
914

1015
- repo: local
1116
hooks:

{{cookiecutter.project_name}}/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ lint:
8686
PYTHONPATH=./app $(MANAGER) run pylint app
8787
PYTHONPATH=./app $(MANAGER) run mypy --namespace-packages --show-error-codes app --check-untyped-defs --ignore-missing-imports --show-traceback
8888

89-
safety:
90-
$(MANAGER) run safety check --policy-file=.safety-policy.yml
9189

9290
check-changed-loc:
9391
chmod +x ./scripts/pr-max-diff-checker.sh

{{cookiecutter.project_name}}/pyproject-uv.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ dev-dependencies = [
3939
{%- elif cookiecutter.linter == 'Ruff' %}
4040
"ruff==0.5.7",
4141
{%- endif %}
42+
"pip-audit==2.7.3",
4243
"mypy==1.9.0",
4344
"pylint==3.1.0",
44-
"safety==3.1.0",
4545
]
4646

4747
{%- if cookiecutter.linter == 'Flake8' %}

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ flake8-rst-docstrings = "^0.3.0"
3737
{%- elif cookiecutter.linter == 'Ruff' %}
3838
ruff = "^0.5.7"
3939
{%- endif %}
40+
pip-audit="^2.7.3"
4041
mypy = "^1.9.0"
4142
pylint = "^3.1.0"
4243
pylint-django = "^2.5.4"
43-
safety = "^3.1.0"
4444
pytest-randomly = "^3.15.0"
4545
faker = "^28.4.1"
4646
factory-boy = "^3.3.1"

0 commit comments

Comments
 (0)