Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2ba062b
#402: Created nox task to detect resolved GitHub security issues
ckunki Apr 5, 2026
282591f
added typehint to get_vulnerabilities_from_latest_tag
ckunki Apr 6, 2026
8b1e7b8
Validated warning in test
ckunki Apr 6, 2026
91aebce
Renamed method resolved to resolved_vulnerabilities
ckunki Apr 6, 2026
8d097a5
Renamed nox task and class SecurityAudit once again
ckunki Apr 6, 2026
9bd15c9
Added integration test
ckunki Apr 6, 2026
fc12b43
merged changes from changelog.py
ckunki Apr 9, 2026
efc20f5
Merge branch 'main' into feature/402-Created_nox_task_to_detect_resol…
ckunki Apr 12, 2026
80533dd
Merge branch 'main' into feature/402-Nox_session_report_resolved_secu…
ckunki Apr 13, 2026
f799f7a
Removed comment
ckunki Apr 13, 2026
8d6f7a4
Removed unused imports
ckunki Apr 13, 2026
bf09229
Merge branch 'main' into feature/402-Nox_session_report_resolved_secu…
ckunki Apr 13, 2026
99d52ef
nox -s format:fix
ckunki Apr 13, 2026
540b639
Upload metrics.json only once and only for the main branch
ckunki Apr 13, 2026
e8fe9a2
Modified trigger
ckunki Apr 13, 2026
0e8eced
Modified trigger (2)
ckunki Apr 13, 2026
b732144
fixed unit test
ckunki Apr 13, 2026
b14b070
Updated GitHub workflows
ckunki Apr 13, 2026
22539a9
nox -s format:fix
ckunki Apr 13, 2026
0de28bd
Fixed unit tests
ckunki Apr 13, 2026
df330e1
Updated workflows once again
ckunki Apr 14, 2026
59911f3
fixed typo in event name
ckunki Apr 14, 2026
117362c
Apply suggestions from code review
ckunki Apr 14, 2026
ae9a41d
Added comment for CLI option --disable-pip to pip-audit
ckunki Apr 14, 2026
05c2143
Update .github/workflows/ci.yml
ckunki Apr 14, 2026
e70a2ef
Fixed test naming and implementation
ckunki Apr 14, 2026
c68943b
Merge branch 'main' into feature/402-Nox_session_report_resolved_secu…
ckunki Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .github/workflows/merge-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Merge-Gate

on:
workflow_call:
inputs:
root-event:
description: GitHub event triggering the root workflow ci.yml
required: false
type: string
default: unknown

jobs:
run-fast-checks:
Expand All @@ -15,12 +21,15 @@ jobs:
needs:
- run-fast-checks
uses: ./.github/workflows/report.yml
with:
upload-metrics: false
secrets: inherit
permissions:
contents: read

approve-run-slow-tests:
name: Approve Running Slow Tests?
if: ${{ inputs.root-event != 'schedule' }}
runs-on: "ubuntu-24.04"
permissions:
contents: read
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-merge.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .github/workflows/report.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions doc/changes/changes_0.15.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

## 🔩 Internal

* Update depdency constraints
* Relock dependencies
* Update dependency constraints
* Relock dependencies
6 changes: 6 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The `report.yml` is also called after the `checks.yml` completes. This allows us
to get linting, security, and unit test coverage before running the `slow-checks.yml`,
as described in the [Pull Request description](https://exasol.github.io/python-toolbox/main/user_guide/features/github_workflows/index.html#pull-request).

This release also adds a `vulnerabilities:resolved` Nox session, which reports GitHub security issues resolved since the last release.

This release fixes a vulnerability by updating the `poetry.lock` file.

| Name | Version | ID | Fix Versions | Updated to |
Expand All @@ -19,6 +21,10 @@ This release fixes a vulnerability by updating the `poetry.lock` file.

To ensure usage of secure packages, it is up to the user to similarly relock their dependencies.

## Features

* #402: Created nox session `vulnerabilities:resolved` to report resolved GitHub security issues

## Refactoring

* #764: Updated `action/upload-pages-artifact` from v4 to [v5](https://github.com/actions/upload-pages-artifact/releases/tag/v5.0.0)
Expand Down
27 changes: 16 additions & 11 deletions doc/user_guide/features/managing_dependencies.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
Managing dependencies
=====================
Managing Dependencies and Vulnerabilities
=========================================

+--------------------------+------------------+----------------------------------------+
| Nox session | CI Usage | Action |
+==========================+==================+========================================+
| ``dependency:licenses`` | ``report.yml`` | Uses ``pip-licenses`` to return |
| | | packages with their licenses |
+--------------------------+------------------+----------------------------------------+
| ``dependency:audit`` | No | Uses ``pip-audit`` to return active |
| | | vulnerabilities in our dependencies |
+--------------------------+------------------+----------------------------------------+
+------------------------------+----------------+-------------------------------------+
| Nox session | CI Usage | Action |
+==============================+================+=====================================+
| ``dependency:licenses`` | ``report.yml`` | Uses ``pip-licenses`` to return |
| | | packages with their licenses |
+------------------------------+----------------+-------------------------------------+
| ``dependency:audit`` | No | Uses ``pip-audit`` to report active |
| | | vulnerabilities in our dependencies |
+------------------------------+----------------+-------------------------------------+
| ``vulnerabilities:resolved`` | No | Uses ``pip-audit`` to report known |
| | | vulnerabilities in dependencies |
| | | that have been resolved in |
| | | comparison to the last release. |
+------------------------------+----------------+-------------------------------------+
19 changes: 17 additions & 2 deletions exasol/toolbox/nox/_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@
from exasol.toolbox.util.dependencies.audit import (
PipAuditException,
Vulnerabilities,
get_vulnerabilities,
get_vulnerabilities_from_latest_tag,
)
from exasol.toolbox.util.dependencies.licenses import (
PackageLicenseReport,
get_licenses,
)
from exasol.toolbox.util.dependencies.poetry_dependencies import get_dependencies
from exasol.toolbox.util.dependencies.track_vulnerabilities import DependenciesAudit
from noxconfig import PROJECT_CONFIG


@nox.session(name="dependency:licenses", python=False)
def dependency_licenses(session: Session) -> None:
"""Return the packages with their licenses"""
"""Report licenses for all dependencies."""
dependencies = get_dependencies(working_directory=Path())
licenses = get_licenses()
license_markdown = PackageLicenseReport(
Expand All @@ -30,7 +34,7 @@ def dependency_licenses(session: Session) -> None:

@nox.session(name="dependency:audit", python=False)
def audit(session: Session) -> None:
"""Check for known vulnerabilities"""
"""Report known vulnerabilities."""

try:
vulnerabilities = Vulnerabilities.load_from_pip_audit(working_directory=Path())
Expand All @@ -39,3 +43,14 @@ def audit(session: Session) -> None:

security_issue_dict = vulnerabilities.security_issue_dict
print(json.dumps(security_issue_dict, indent=2))


@nox.session(name="vulnerabilities:resolved", python=False)
def report_resolved_vulnerabilities(session: Session) -> None:
"""Report resolved vulnerabilities in dependencies."""
path = PROJECT_CONFIG.root_path
audit = DependenciesAudit(
previous_vulnerabilities=get_vulnerabilities_from_latest_tag(path),
current_vulnerabilities=get_vulnerabilities(path),
)
print(audit.report_resolved_vulnerabilities())
4 changes: 2 additions & 2 deletions exasol/toolbox/templates/github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

build-and-publish:
needs:
- check-release-tag
- check-release-tag
name: Build & Publish
uses: ./.github/workflows/build-and-publish.yml
permissions:
Expand All @@ -25,7 +25,7 @@ jobs:

publish-docs:
needs:
- build-and-publish
- build-and-publish
name: Publish Documentation
uses: ./.github/workflows/gh-pages.yml
permissions:
Expand Down
9 changes: 8 additions & 1 deletion exasol/toolbox/templates/github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ jobs:
merge-gate:
name: Merge Gate
uses: ./.github/workflows/merge-gate.yml
with:
root-event: ${{ github.event_name }}
secrets: inherit
permissions:
contents: read

report:
# Job merge-gate requires manual approval for running the slow checks. If
# current workflow ci.yml is triggered by schedule, there is no manual
# interaction, manual approval will never be given, slow checks will not
# be executed, merge-gate will never terminate, and the report will never
# be called.
name: Report
needs:
- merge-gate
- merge-gate
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

deploy-documentation:
needs:
- build-documentation
- build-documentation
permissions:
contents: read
pages: write
Expand Down
15 changes: 12 additions & 3 deletions exasol/toolbox/templates/github/workflows/merge-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Merge-Gate

on:
workflow_call:
inputs:
root-event:
description: GitHub event triggering the root workflow ci.yml
required: false
type: string
default: unknown

jobs:
run-fast-checks:
Expand All @@ -15,12 +21,15 @@ jobs:
needs:
- run-fast-checks
uses: ./.github/workflows/report.yml
with:
upload-metrics: false
secrets: inherit
permissions:
contents: read

approve-run-slow-tests:
name: Approve Running Slow Tests?
if: ${{ inputs.root-event != 'schedule' }}
runs-on: "(( os_version ))"
permissions:
contents: read
Expand All @@ -35,7 +44,7 @@ jobs:
run-slow-checks:
name: Slow Checks
needs:
- approve-run-slow-tests
- approve-run-slow-tests
uses: ./.github/workflows/slow-checks.yml
secrets: inherit
permissions:
Expand All @@ -49,8 +58,8 @@ jobs:
contents: read
# If you need additional jobs to be part of the merge gate, add them below
needs:
- run-fast-checks
- run-slow-checks
- run-fast-checks
- run-slow-checks
# Each job requires a step, so we added this dummy step.
steps:
- name: Approve
Expand Down
4 changes: 3 additions & 1 deletion exasol/toolbox/templates/github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ jobs:

report:
needs:
- run-fast-checks
- run-fast-checks
uses: ./.github/workflows/report.yml
with:
upload-metrics: true
secrets: inherit
permissions:
contents: read
5 changes: 5 additions & 0 deletions exasol/toolbox/templates/github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Status Report

on:
workflow_call:
inputs:
upload-metrics:
description: Whether to upload file metrics.json as artifact
type: boolean
default: false

jobs:

Expand Down
8 changes: 6 additions & 2 deletions exasol/toolbox/util/dependencies/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ def audit_poetry_files(working_directory: Path) -> str:
tmpdir = Path(path)
(tmpdir / requirements_txt).write_text(output.stdout)

command = ["pip-audit", "-r", requirements_txt, "-f", "json"]
# CLI option `--disable-pip` skips dependency resolution in pip. The
# option can be used with hashed requirements files (which is the case
# here) to avoid `pip-audit` installing an isolated environment and
# speed up the audit significantly.
command = ["pip-audit", "--disable-pip", "-r", requirements_txt, "-f", "json"]
output = subprocess.run(
command,
capture_output=True,
Expand Down Expand Up @@ -239,6 +243,6 @@ def get_vulnerabilities(working_directory: Path) -> list[Vulnerability]:
).vulnerabilities


def get_vulnerabilities_from_latest_tag(root_path: Path):
def get_vulnerabilities_from_latest_tag(root_path: Path) -> list[Vulnerability]:
with poetry_files_from_latest_tag(root_path=root_path) as tmp_dir:
return get_vulnerabilities(working_directory=tmp_dir)
Loading