Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

chore(security): name the advisories in the warning and pin the image boundary

Nikhi5bdff29c324a
diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml
index 46b2a23d..6a95a6ce 100644
--- a/.github/workflows/security.yml
+++ b/.github/workflows/security.yml
@@ -121,7 +121,12 @@ jobs:
exit "$code"
fi
if [ "$code" -ne 0 ]; then
- echo "::warning::advisories in optional-integration dependencies -- visible here, not blocking PRs (see #645/#646)"
+ # Name the advisories in the annotation itself, so a triager sees WHAT was found
+ # without opening the log (#694 review). Only the pip-audit table IDs (GHSA/PYSEC):
+ # --desc bodies quote CVE- ids in prose, and a warning that repeats prose noise is
+ # a warning nobody reads.
+ ids=$(grep -oE "(GHSA|PYSEC)-[A-Za-z0-9-]+" pip-audit-extras.log | sort -u | tr '\n' ' ')
+ echo "::warning::advisories in optional-integration dependencies: ${ids% } -- visible here, not blocking PRs (see #645)"
fi
codeql:
diff --git a/tests/test_audit_scope.py b/tests/test_audit_scope.py
index 811013d3..4350afa1 100644
--- a/tests/test_audit_scope.py
+++ b/tests/test_audit_scope.py
@@ -103,6 +103,15 @@ check_true("pyproject/scope split covers every declared name",
sorted(set(shipped) | set(advisory)) == expected and not set(shipped) & set(advisory),
"shipped and advisory must partition the declared specs")
+# The blocking scope rests on one declaration-level fact: the image installs the [serve] extra
+# and no other (#694 review). If the Dockerfile ever reads `pip install ".[serve,onnx]"`, onnx
+# would ship in the image while sitting in the advisory bucket, and nothing would go red.
+dockerfile = read("Dockerfile")
+image_extras = sorted({e.strip()
+ for group in re.findall(r"pip install[^\n]*?\.\[([^\]]*)\]", dockerfile)
+ for e in group.split(",") if e.strip()})
+check("Dockerfile/the image installs only the [serve] extra", image_extras, ["serve"])
+
# ---------------------------------------------------------------- the job's own extractors
deps_job = "\n".join(section(read(os.path.join(".github", "workflows", "security.yml")),
" deps:"))
@@ -160,6 +169,10 @@ check_true("security.yml/extras findings are advisory without swallowing tooling
and "::warning::" in deps_job
and "::error::" in deps_job,
"#646: a findings report warns, a broken audit (no report) must still fail the job")
+check_true("security.yml/the advisory annotation names the advisories themselves",
+ re.search(r"ids=\$\(grep[^\n]*(GHSA|PYSEC)[^\n]*pip-audit-extras\.log", deps_job) is not None
+ and "${ids" in deps_job,
+ "a triager reads WHAT was found from the annotation, not by opening the log (#694 review)")
ran = False
if sys.version_info >= (3, 11) and core_extractor and extras_extractor: