-
Notifications
You must be signed in to change notification settings - Fork 0
fix(security): bump yt-dlp, setuptools, torch to patched releases #1033
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
Open
seonghobae
wants to merge
10
commits into
develop
Choose a base branch
from
fix/python-dep-cves-ytdlp-setuptools-torch
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1c00c8a
fix(security): bump yt-dlp 2026.8.19, setuptools 84.0.0, torch 2.13.0
seonghobae 26149df
test(security): pin patched Python dependency policy
seonghobae b49f3a7
docs(security): retire obsolete Python exceptions
seonghobae 7fd551d
docs(changelog): record Python dependency baseline
seonghobae 1106d9b
fix(test): satisfy Ruff dependency baseline checks
seonghobae c9dd169
test(security): guard retired Python exceptions
seonghobae fadeec6
fix(security): retire patched setuptools exception
seonghobae 3a04805
fix(security): normalize dependency baseline test imports
seonghobae 69b8d81
test(security): pin torch platform ownership
seonghobae 046db56
Merge branch 'develop' into fix/python-dep-cves-ytdlp-setuptools-torch
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
services/analysis-engine/tests/test_python_dependency_security_baseline.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| """Regression contracts for BandScope's patched Python dependency baseline.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import tomllib | ||
| from pathlib import Path | ||
|
|
||
| REPO_ROOT = Path(__file__).resolve().parents[3] | ||
| PYPROJECT = REPO_ROOT / "services" / "analysis-engine" / "pyproject.toml" | ||
| UV_LOCK = REPO_ROOT / "services" / "analysis-engine" / "uv.lock" | ||
| DEPENDENCY_POLICY = REPO_ROOT / "docs" / "security" / "dependency-policy.md" | ||
| TRIVYIGNORE = REPO_ROOT / ".trivyignore" | ||
|
|
||
|
|
||
| def _locked_version(package_name: str) -> str: | ||
| """Return the single locked version for ``package_name``.""" | ||
| lock = tomllib.loads(UV_LOCK.read_text(encoding="utf-8")) | ||
| matches = [ | ||
| package.get("version") | ||
| for package in lock.get("package", []) | ||
| if package.get("name") == package_name | ||
| ] | ||
| assert len(matches) == 1 | ||
| version = matches[0] | ||
| assert isinstance(version, str) | ||
| return version | ||
|
|
||
|
|
||
| def _project_dependencies() -> list[str]: | ||
| """Return validated direct analysis-engine dependency requirements.""" | ||
| pyproject = tomllib.loads(PYPROJECT.read_text(encoding="utf-8")) | ||
| project = pyproject.get("project") | ||
| assert isinstance(project, dict) | ||
| dependencies = project.get("dependencies") | ||
| assert isinstance(dependencies, list) | ||
| assert all(isinstance(requirement, str) for requirement in dependencies) | ||
| return dependencies | ||
|
|
||
|
|
||
| def _active_exceptions(policy: str) -> str: | ||
| """Return the policy's controlled-exception section and fail on schema drift.""" | ||
| _prefix, start, remainder = policy.partition("Current controlled exceptions:") | ||
| assert start | ||
| active, end, _retired = remainder.partition( | ||
| "Retired third-party deprecation and advisory signal:" | ||
| ) | ||
| assert end | ||
| return active | ||
|
|
||
|
|
||
| def test_python_security_baseline_keeps_patched_versions() -> None: | ||
| """Prevent reintroduction of the patched setuptools, torch, and yt-dlp releases.""" | ||
| assert _locked_version("setuptools") == "84.0.0" | ||
| assert _locked_version("torch") == "2.13.0" | ||
| assert _locked_version("yt-dlp") == "2026.8.19" | ||
|
|
||
|
|
||
| def test_torch_security_policy_matches_supported_platform_contract() -> None: | ||
| """Retire obsolete torch exceptions while preserving macOS Intel exclusion.""" | ||
| dependencies = _project_dependencies() | ||
| policy = DEPENDENCY_POLICY.read_text(encoding="utf-8") | ||
| active_exceptions = _active_exceptions(policy) | ||
| expected_demucs_requirement = ( | ||
| "demucs>=4.0.1 ; sys_platform != 'darwin' or platform_machine == 'arm64'" | ||
| ) | ||
|
|
||
| assert expected_demucs_requirement in dependencies | ||
| assert not any(requirement.lower().startswith("torch") for requirement in dependencies) | ||
| assert "GHSA-53q9-r3pm-6pq6" not in active_exceptions | ||
| assert "GHSA-rrmf-rvhw-rf47" not in active_exceptions | ||
| assert "torch 2.2.2" not in active_exceptions | ||
| assert ".github/workflows/dependency-review.yml" not in policy | ||
| assert "services/analysis-engine/osv-scanner.toml" not in policy | ||
| assert "macOS Intel" in policy | ||
| assert "does not install Demucs or torch" in policy | ||
|
|
||
|
|
||
| def test_setuptools_security_exception_is_retired() -> None: | ||
| """Reject the obsolete setuptools CVE exception after upgrading past its patch floor.""" | ||
| policy = DEPENDENCY_POLICY.read_text(encoding="utf-8") | ||
| trivyignore = TRIVYIGNORE.read_text(encoding="utf-8") | ||
|
|
||
| assert "GHSA-h35f-9h28-mq5c" not in _active_exceptions(policy) | ||
| assert "CVE-2026-59890" not in trivyignore | ||
|
|
||
|
|
||
| def test_yt_dlp_policy_distinguishes_patch_floor_from_current_lock() -> None: | ||
| """Keep the advisory's patched floor distinct from the intentionally newer lock.""" | ||
| pyproject = PYPROJECT.read_text(encoding="utf-8") | ||
| policy = DEPENDENCY_POLICY.read_text(encoding="utf-8") | ||
|
|
||
| assert '"yt-dlp>=2026.8.19"' in pyproject | ||
| assert "GHSA-6v4j-43gg-vj32" in policy | ||
| assert "fixed in 2026.7.4" in policy | ||
| assert "2026.8.19" in policy |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.