style: apply supply-chain checker formatting

This commit is contained in:
rookiestar28
2026-05-13 10:45:02 +08:00
parent 2c98df607e
commit bdf1a0a9ad
3 changed files with 12 additions and 5 deletions
+6 -3
View File
@@ -17,7 +17,6 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Iterable
AFFECTED_NPM_PREFIXES = (
"@tanstack/",
"@uipath/",
@@ -165,8 +164,12 @@ def check_npm_lock(lock_path: Path) -> list[Finding]:
return findings
_REQ_NAME_RE = re.compile(r"^\s*([A-Za-z0-9_.-]+)\s*(?:\[.*?\])?\s*(?:[<>=!~]=|==|~=|>|<|$)")
_TOML_DEP_RE = re.compile(r"""["']([A-Za-z0-9_.-]+)(?:\[.*?\])?\s*(?:[<>=!~]=|==|~=|>|<|["'])""")
_REQ_NAME_RE = re.compile(
r"^\s*([A-Za-z0-9_.-]+)\s*(?:\[.*?\])?\s*(?:[<>=!~]=|==|~=|>|<|$)"
)
_TOML_DEP_RE = re.compile(
r"""["']([A-Za-z0-9_.-]+)(?:\[.*?\])?\s*(?:[<>=!~]=|==|~=|>|<|["'])"""
)
def check_python_manifest(path: Path) -> list[Finding]:
@@ -52,7 +52,9 @@ class TestSupplyChainWorkflowPolicy(unittest.TestCase):
text,
re.compile(r"uses: Comfy-Org/publish-node-action@[a-f0-9]{40}\b"),
)
self.assertIn("personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}", text)
self.assertIn(
"personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}", text
)
def test_dependency_review_gate_is_present_for_dependency_diffs(self):
text = (WORKFLOW_ROOT / "dependency-review.yml").read_text(encoding="utf-8")
+3 -1
View File
@@ -65,7 +65,9 @@ class TestSupplyChainHardening(unittest.TestCase):
def test_affected_python_requirement_is_reported(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
(root / "requirements.txt").write_text("mistralai==2.4.6\n", encoding="utf-8")
(root / "requirements.txt").write_text(
"mistralai==2.4.6\n", encoding="utf-8"
)
findings = hardening.run_checks(root)