Skip to content

Commit 58773f8

Browse files
Add nox target for auditing workspaces in reagard to known vulnerabilities (#347)
1 parent ca70469 commit 58773f8

File tree

7 files changed

+496
-97
lines changed

7 files changed

+496
-97
lines changed

.github/workflows/checks.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,25 @@ jobs:
117117
path: .security.json
118118
include-hidden-files: true
119119

120+
Vulnerabilities:
121+
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
122+
needs: [ Version-Check, build-matrix ]
123+
runs-on: ubuntu-latest
124+
strategy:
125+
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
126+
127+
steps:
128+
- name: SCM Checkout
129+
uses: actions/checkout@v4
130+
131+
- name: Setup Python & Poetry Environment
132+
uses: ./.github/actions/python-environment
133+
with:
134+
python-version: ${{ matrix.python-version }}
135+
136+
- name: Run Package vulnerabilities Check
137+
run: poetry run nox -s dependency:audit
138+
120139
Format:
121140
name: Format Check
122141
runs-on: ubuntu-latest

doc/changes/unreleased.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
# Unreleased
2+
3+
## ✨ Added
4+
5+
* [#73](https://github.com/exasol/python-toolbox/issues/73): Added nox target for auditing work spaces in regard to known vulnerabilities

exasol/toolbox/nox/_dependencies.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,20 @@ def _normalize_package_name(name: str) -> str:
212212
return template.format(heading=heading(), rows=rows)
213213

214214

215+
def _audit(session: Session) -> None:
216+
session.run("poetry", "run", "pip-audit")
217+
218+
215219
@nox.session(name="dependency:licenses", python=False)
216220
def dependency_licenses(session: Session) -> None:
217221
"""returns the packages and their licenses"""
218222
toml = Path("pyproject.toml")
219223
dependencies = _dependencies(toml.read_text())
220224
package_infos = _licenses()
221225
print(_packages_to_markdown(dependencies=dependencies, packages=package_infos))
226+
227+
228+
@nox.session(name="dependency:audit", python=False)
229+
def audit(session: Session) -> None:
230+
"""Check for known vulnerabilities"""
231+
_audit(session)

exasol/toolbox/nox/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def check(session: Session) -> None:
8181

8282
from exasol.toolbox.nox._dependencies import (
8383
dependency_licenses,
84+
audit
8485
)
8586

8687
# isort: on

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@ jobs:
123123
path: .security.json
124124
include-hidden-files: true
125125

126+
Vulnerabilities:
127+
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
128+
needs: [ Version-Check, build-matrix ]
129+
runs-on: ubuntu-latest
130+
strategy:
131+
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
132+
133+
steps:
134+
- name: SCM Checkout
135+
uses: actions/checkout@v4
136+
137+
- name: Setup Python & Poetry Environment
138+
uses: ./.github/actions/python-environment
139+
with:
140+
python-version: ${{ matrix.python-version }}
141+
142+
- name: Run Package vulnerabilities Check
143+
run: poetry run nox -s dependency:audit
144+
126145
Format:
127146
name: Format Check
128147
runs-on: ubuntu-latest

poetry.lock

Lines changed: 442 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ typer = {extras = ["all"], version = ">=0.7.0"}
5959
bandit = {extras = ["toml"], version = "^1.7.9"}
6060
jinja2 = "^3.1.4"
6161
pip-licenses = "^5.0.0"
62+
pip-audit = "^2.7.3"
6263

6364
[tool.poetry.group.dev.dependencies]
6465
autoimport = "^1.4.0"

0 commit comments

Comments
 (0)