-
-
Notifications
You must be signed in to change notification settings - Fork 419
fix release build version stamping and smoke runtime install #868
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,9 +24,41 @@ native_runtime_dir="$(scripts/ci-prepare-native-runtime.sh "$OUT_DIR" "$BACKEND" | |||||||||||||||||||||
| echo "Installing CI native runtime:" >&2 | ||||||||||||||||||||||
| echo " runtime: $native_runtime_dir" >&2 | ||||||||||||||||||||||
| echo " cache: $RUNTIME_CACHE" >&2 | ||||||||||||||||||||||
| MESH_LLM_NATIVE_RUNTIME_CACHE_DIR="$RUNTIME_CACHE" \ | ||||||||||||||||||||||
| "$MESH_LLM" runtime install \ | ||||||||||||||||||||||
| --bundle-dir "$native_runtime_dir" \ | ||||||||||||||||||||||
| --cache-dir "$RUNTIME_CACHE" >&2 | ||||||||||||||||||||||
| python3 - "$native_runtime_dir" "$RUNTIME_CACHE" <<'PY' | ||||||||||||||||||||||
| import json | ||||||||||||||||||||||
| import shutil | ||||||||||||||||||||||
| import sys | ||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| source = Path(sys.argv[1]) | ||||||||||||||||||||||
| cache = Path(sys.argv[2]) | ||||||||||||||||||||||
| manifest_path = source / "manifest.json" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| with manifest_path.open("r", encoding="utf-8") as fh: | ||||||||||||||||||||||
| manifest = json.load(fh) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| runtime = manifest["runtime"] | ||||||||||||||||||||||
| runtime_id = runtime["id"] | ||||||||||||||||||||||
| mesh_version = runtime.get("mesh_version") or "unknown" | ||||||||||||||||||||||
| libraries = runtime.get("libraries") or [] | ||||||||||||||||||||||
| if not runtime_id.strip(): | ||||||||||||||||||||||
| raise SystemExit(f"native runtime id is empty in {manifest_path}") | ||||||||||||||||||||||
| if not mesh_version.strip(): | ||||||||||||||||||||||
| raise SystemExit(f"native runtime mesh_version is empty in {manifest_path}") | ||||||||||||||||||||||
| if not libraries: | ||||||||||||||||||||||
| raise SystemExit(f"native runtime libraries are empty in {manifest_path}") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| for library in libraries: | ||||||||||||||||||||||
| library_path = source / library | ||||||||||||||||||||||
| if not library_path.is_file(): | ||||||||||||||||||||||
| raise SystemExit(f"native runtime library is missing: {library_path}") | ||||||||||||||||||||||
|
Comment on lines
+51
to
+54
Contributor
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. Constrain library paths to stay within the runtime bundle root On Lines 51-54, Proposed fix for library in libraries:
- library_path = source / library
- if not library_path.is_file():
+ library_path = (source / library).resolve()
+ if source.resolve() not in library_path.parents:
+ raise SystemExit(f"native runtime library escapes bundle root: {library}")
+ if not library_path.is_file():
raise SystemExit(f"native runtime library is missing: {library_path}")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| target = cache / mesh_version / runtime_id | ||||||||||||||||||||||
| if target.exists(): | ||||||||||||||||||||||
| shutil.rmtree(target) | ||||||||||||||||||||||
| target.parent.mkdir(parents=True, exist_ok=True) | ||||||||||||||||||||||
| shutil.copytree(source, target) | ||||||||||||||||||||||
| print(f"Installed CI native runtime: {target}", file=sys.stderr) | ||||||||||||||||||||||
| PY | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| printf '%s\n' "$RUNTIME_CACHE" | ||||||||||||||||||||||
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.
Fail fast when
mesh_versionis missing instead of defaulting to"unknown"On Line 42, falling back to
"unknown"hides manifest contract breaks and can install into the wrong cache subtree (<cache>/unknown/<runtime_id>). This should error immediately so CI fails at root cause.Proposed fix
🤖 Prompt for AI Agents