Skip to content

Commit bf3baa1

Browse files
committed
Update safety to v3
1 parent 9075325 commit bf3baa1

File tree

6 files changed

+190
-40
lines changed

6 files changed

+190
-40
lines changed

.github/workflows/linter.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ jobs:
4646
- name: Install dependencies
4747
run: poetry install --all-extras
4848

49-
- uses: pre-commit/[email protected]
49+
- uses: pre-commit/[email protected]
50+
env:
51+
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}

.pre-commit-config.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ repos:
3030
types: ['python']
3131
- id: safety
3232
name: Safety
33-
# Ignore sql-alchemy and wheel vulnerabilities
34-
entry: poetry run safety check --full-report -i 51668
33+
entry: poetry run safety --stage cicd scan --policy-file .safety-policy.yml
3534
pass_filenames: false
3635
language: system
3736
- id: mypy

.safety-policy.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: '3.0'
2+
3+
scanning-settings:
4+
max-depth: 6
5+
exclude: []
6+
include-files: []
7+
system:
8+
targets: []
9+
10+
11+
report:
12+
dependency-vulnerabilities:
13+
enabled: true
14+
auto-ignore-in-report:
15+
python:
16+
environment-results: true
17+
unpinned-requirements: true
18+
cvss-severity: []
19+
vulnerabilities:
20+
64459:
21+
reason: Python wide vulnerability.
22+
expires: '2024-12-12'
23+
64396:
24+
reason: Python wide vulnerability.
25+
expires: '2024-12-12'
26+
67599:
27+
reason: Only applies if using private package repo.
28+
expires: '2026-04-17'
29+
51668:
30+
reason: We cannot currently use SQL Alchemy v2.
31+
expires: '2024-12-12'
32+
33+
34+
fail-scan-with-exit-code:
35+
dependency-vulnerabilities:
36+
enabled: true
37+
fail-on-any-of:
38+
cvss-severity:
39+
- medium
40+
- critical
41+
- high
42+
exploitability:
43+
- medium
44+
- critical
45+
- high
46+
47+
security-updates:
48+
dependency-vulnerabilities:
49+
auto-security-updates-limit:
50+
- patch

docs/content/setup.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ Install the Pre-Commit hooks:
4848
pre-commit install
4949
```
5050

51-
and run them with:
51+
set an environment variable with your [safety API key](https://docs.safetycli.com/safety-docs/support/invalid-api-key-error#how-to-get-a-safety-api-key):
52+
53+
```bash
54+
export SAFETY_API_KEY=your-api-key
55+
```
56+
57+
and run the checks with:
5258

5359
```bash
5460
pre-commit run --all-files

poetry.lock

+126-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)