-
Notifications
You must be signed in to change notification settings - Fork 2
#750: Updated dependency pip-audit #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e2f486b
57577d4
a4d71ed
f9cdbdb
33d92ef
84ca6f9
2abfaab
1234d9a
f7bd55a
711b19a
de7a3cb
3d8f2f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # 6.1.1 - 2026-03-18 | ||
|
|
||
| ## Summary | ||
|
|
||
| ## Security Issues | ||
|
|
||
| * #748: Updated dependency to `black` | ||
|
|
||
| ## Refactorings | ||
|
|
||
| * #752: Updated upload-artifact from v6 to v7 and download-artifact from v7 to v8 | ||
| * #750: Updated dependency `pip-audit` | ||
|
|
||
| ## Dependency Updates | ||
|
|
||
| ### `main` | ||
|
|
||
| * Updated dependency `bandit:1.9.3` to `1.9.4` | ||
| * Updated dependency `black:25.12.0` to `26.3.1` | ||
| * Updated dependency `coverage:7.13.1` to `7.13.4` | ||
| * Updated dependency `import-linter:2.9` to `2.11` | ||
| * Updated dependency `nox:2025.11.12` to `2026.2.9` | ||
| * Updated dependency `pip-audit:2.9.0` to `2.10.0` | ||
| * Updated dependency `pip-licenses:5.5.0` to `5.5.1` | ||
| * Updated dependency `pylint:4.0.4` to `4.0.5` | ||
| * Updated dependency `ruff:0.14.13` to `0.14.14` | ||
| * Updated dependency `sphinxcontrib-mermaid:2.0.0` to `2.0.1` | ||
| * Updated dependency `typer:0.21.1` to `0.24.1` | ||
|
|
||
| ### `dev` | ||
|
|
||
| * Updated dependency `cookiecutter:2.6.0` to `2.7.1` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,3 @@ | ||
| # Unreleased | ||
|
|
||
| ## Summary | ||
|
|
||
| ## Security Issues | ||
|
|
||
| * #748: Updated dependency to `black` | ||
|
|
||
| ## Refactoring | ||
|
|
||
| * #752: Updated upload-artifact from v6 to v7 and download-artifact from v7 to v8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,16 +27,18 @@ | |
| ) | ||
|
|
||
|
|
||
| PipAuditEntry = dict[str, str | list[str] | tuple[str, ...]] | ||
|
|
||
|
|
||
| @dataclass | ||
| class PipAuditException(Exception): | ||
| return_code: int | ||
| returncode: int | ||
| stdout: str | ||
| stderr: str | ||
|
|
||
| def __init__(self, subprocess_output: subprocess.CompletedProcess) -> None: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, adding method |
||
| self.return_code = subprocess_output.returncode | ||
| self.stdout = subprocess_output.stdout | ||
| self.stderr = subprocess_output.stderr | ||
| @classmethod | ||
| def from_subprocess(cls, proc: subprocess.CompletedProcess) -> PipAuditException: | ||
| return cls(proc.returncode, proc.stdout, proc.stderr) | ||
|
|
||
|
|
||
| class VulnerabilitySource(str, Enum): | ||
|
|
@@ -102,7 +104,7 @@ def reference_links(self) -> tuple[str, ...]: | |
| ) | ||
|
|
||
| @property | ||
| def security_issue_entry(self) -> dict[str, str | list[str] | tuple[str, ...]]: | ||
| def security_issue_entry(self) -> PipAuditEntry: | ||
| return { | ||
| "name": self.package.name, | ||
| "version": str(self.package.version), | ||
|
|
@@ -132,10 +134,20 @@ def subsection_for_changelog_summary(self) -> str: | |
| """ | ||
| Create a subsection to be included in the Summary section of a versioned changelog. | ||
| """ | ||
| links_join = "\n* ".join(sorted(self.reference_links)) | ||
| references_subsection = f"\n#### References:\n\n* {links_join}\n\n " | ||
| subsection = f"### {self.vulnerability_id} in {self.package.coordinates}\n\n{self.description}\n{references_subsection}" | ||
| return cleandoc(subsection.strip()) | ||
| indent = " " * 12 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a |
||
| references = f"\n{indent}".join( | ||
| f"* {link}" for link in sorted(self.reference_links) | ||
| ) | ||
| description = self.description.replace("\n", f"\n{indent}") | ||
| return cleandoc(f""" | ||
| ### {self.vulnerability_id} in {self.package.coordinates} | ||
|
|
||
| {description} | ||
|
|
||
| #### References | ||
|
|
||
| {references} | ||
| """) | ||
|
|
||
|
|
||
| def audit_poetry_files(working_directory: Path) -> str: | ||
|
|
@@ -159,7 +171,7 @@ def audit_poetry_files(working_directory: Path) -> str: | |
| cwd=working_directory, | ||
| ) # nosec | ||
| if output.returncode != 0: | ||
| raise PipAuditException(subprocess_output=output) | ||
| raise PipAuditException.from_subprocess(output) | ||
|
|
||
| with tempfile.TemporaryDirectory() as path: | ||
| tmpdir = Path(path) | ||
|
|
@@ -179,7 +191,7 @@ def audit_poetry_files(working_directory: Path) -> str: | |
| # they both map to returncode = 1, so we have our own logic to raise errors | ||
| # for the case of 2) and not 1). | ||
| if not search(PIP_AUDIT_VULNERABILITY_PATTERN, output.stderr.strip()): | ||
| raise PipAuditException(subprocess_output=output) | ||
| raise PipAuditException.from_subprocess(output) | ||
| return output.stdout | ||
|
|
||
|
|
||
|
|
@@ -215,7 +227,7 @@ def load_from_pip_audit(cls, working_directory: Path) -> Vulnerabilities: | |
| return Vulnerabilities(vulnerabilities=vulnerabilities) | ||
|
|
||
| @property | ||
| def security_issue_dict(self) -> list[dict[str, str | list[str] | tuple[str, ...]]]: | ||
| def security_issue_dict(self) -> list[PipAuditEntry]: | ||
| return [ | ||
| vulnerability.security_issue_entry for vulnerability in self.vulnerabilities | ||
| ] | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,26 @@ | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from exasol.toolbox.config import BaseConfig | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def poetry_path() -> str: | ||
| result = subprocess.run(["which", "poetry"], capture_output=True, text=True) | ||
| poetry_path = result.stdout.strip() | ||
| return poetry_path | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def ptb_minimum_python_version() -> str: | ||
| """ | ||
| Some integration tests create a sample poetry project and need to | ||
| specify its minimum python version in property "requires-python" in file | ||
| pyproject.toml. | ||
|
|
||
| This fixture returns a value including all python versions supported by | ||
| the PTB. | ||
| """ | ||
| return BaseConfig(root_path=Path(), project_name="toolbox").minimum_python_version |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve readability and reduce typing effort in type hints.