Skip to content

CVE Scanning for Python #1480

CVE Scanning for Python

CVE Scanning for Python #1480

name: CVE Scanning for Python
on:
schedule:
- cron: '0 8,18 * * 1-5'
pull_request:
paths:
- 'pyproject.toml'
- '.safety-policy.yml'
- '.github/workflows/cve-scanning-python.yml'
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
jobs:
scan:
name: Build and test App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.2.2
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: "3.10"
- uses: abatilo/actions-poetry@192395c0d10c082a7c62294ab5d9a9de40e48974
with:
poetry-version: "2.0.0"
- name: Install safety
run: pip3 install safety
- name: Build app
run: poetry build
- name: Test app
run: |
poetry install
- name: Scan CVEs
# IDs below mirror .github/workflows/security.yml: all urllib3/aiohttp findings whose
# fix requires a version that dropped Python 3.9 support (this project's floor, see
# pyproject.toml). Passing -i here (rather than relying only on .safety-policy.yml)
# because the -i flag replaces, rather than merges with, the policy file's
# ignore-vulnerabilities list when both are used together. Revisit when Python 3.9
# support is dropped.
run: >
poetry export --without-hashes -f requirements.txt | safety check --full-report --stdin
-i 96886
-i SFTY-20260511-47957
-i SFTY-20260615-39401
-i SFTY-20260615-18154
-i SFTY-20260615-56865
-i SFTY-20260615-97789
-i SFTY-20260615-89136
-i SFTY-20260615-16622
-i SFTY-20260615-53053
-i SFTY-20260615-28483
-i SFTY-20260603-52923
-i SFTY-20260603-52285
-i SFTY-20260615-45392
# Without poetry, use this command instead
# run: safety check -r requirements.txt --full-report --policy-file safety-policy.yml