Skip to content

Commit f63429c

Browse files
committed
Replace pipenv check with pip-audit
Why these changes are being introduced: As of pipenv 2025.0.1 the use of `pipenv check` would throw an error, indicating that the library `safety` was not installed. It worked to run `pipenv check --auto-install` which would temporarily install `safety`, but this was not ideal for multiple reasons. First, we anticipate potentially moving away from `pipenv`. Second, it appears that `safety` is moving to a pay / subscription model. Third, it remains a little obfuscated what `pipenv check` is actually doing. As this new situation affects all builds in Github Actions CI, we need a way to scan for vulnerabilities that ideally is not a massive overhaul of our vulnerability scanning approach. How this addresses that need: `pip-audit` is a nice standalone, open-source library that performs very similar work to `safety`. This commit replaces `pipenv check` (which was `safety` under the hood) with `pip-audit`. Side effects of this change: * Builds will be successful in Github Actions Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-1240
1 parent 370f5b7 commit f63429c

File tree

4 files changed

+884
-619
lines changed

4 files changed

+884
-619
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ repos:
2222
language: system
2323
pass_filenames: true
2424
types: ["python"]
25-
- id: safety
26-
name: safety
27-
entry: pipenv check
25+
- id: pip-audit
26+
name: pip-audit
27+
entry: pipenv run pip-audit
2828
language: system
2929
pass_filenames: false

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ruff: # Run 'ruff' linter and print a preview of errors
4949
pipenv run ruff check .
5050

5151
safety: # Check for security vulnerabilities and verify Pipfile.lock is up-to-date
52-
pipenv check
52+
pipenv run pip-audit
5353
pipenv verify
5454

5555
lint-apply: # Apply changes with 'black' and resolve 'fixable errors' with 'ruff'

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pre-commit = "*"
2323
pytest = "*"
2424
ruff = "*"
2525
vcrpy = "*"
26+
pip-audit = "*"
2627

2728
[requires]
2829
python_version = "3.12"

0 commit comments

Comments
 (0)