Skip to content

Commit 4986384

Browse files
committed
fix(plugins): defer llama-cpp ssrf-runtime load out of the setup closure
The doctor-contract closure guard forbids the SSRF barrel in the doctor/legacy-setup closure (cold-loads DNS, proxy state, logging); the static import landed with the managed llama-server switch (#123105) and first fails when a PR selects the guard lane. Defer to a dynamic import at download time per the guard's stated remedy.
1 parent c821ade commit 4986384

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎extensions/llama-cpp/src/llama-server-install.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import fs from "node:fs";
44
import fsp from "node:fs/promises";
55
import path from "node:path";
66
import JSZip from "jszip";
7-
import {
8-
fetchWithSsrFGuard,
9-
ssrfPolicyFromHttpBaseUrlAllowedOrigin,
10-
} from "openclaw/plugin-sdk/ssrf-runtime";
117
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
128
import * as tar from "tar";
139
import { resolveLlamaCppDataDir } from "./defaults.js";
@@ -105,6 +101,10 @@ export async function downloadVerifiedFile(params: {
105101
}): Promise<void> {
106102
const partialPath = `${params.destination}.partial-${randomUUID()}`;
107103
await fsp.mkdir(path.dirname(params.destination), { recursive: true });
104+
// Setup/doctor closure must not cold-load the SSRF barrel (DNS, proxy state,
105+
// logging); defer it to actual download time per the closure guard contract.
106+
const { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedOrigin } =
107+
await import("openclaw/plugin-sdk/ssrf-runtime");
108108
try {
109109
const { response, release } = await fetchWithSsrFGuard({
110110
url: params.url,

0 commit comments

Comments
 (0)