Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/lib/adapters/http/curl-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ const CURL_SAFE_FLAG_OPTIONS = new Set([
"-sS",
"-sf",
"-f",
"-L",
"-sfL",
"--fail",
"--silent",
"--show-error",
"--location",
"--compressed",
"--get",
]);
Expand Down
18 changes: 18 additions & 0 deletions src/lib/adapters/http/probe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,24 @@ describe("http-probe helpers", () => {
expect(result.message).toContain("curl probe URL must use http or https");
});

it.each([
["-L", ["-L"]],
["-sfL", ["-sfL"]],
["--location", ["--location"]],
])("rejects redirect-following curl option %s before spawning", (_label, args) => {
let spawned = false;
const result = runCurlProbe(["-sS", ...args, "https://example.test/models"], {
spawnSyncImpl: () => {
spawned = true;
throw new Error("should not spawn");
},
});

expect(spawned).toBe(false);
expect(result.ok).toBe(false);
expect(result.message).toContain("curl probe option is not allowed");
});

it("rejects curl probe request bodies that read from local files", () => {
let spawned = false;
const result = runCurlProbe(
Expand Down
2 changes: 2 additions & 0 deletions src/lib/inference/ollama/model-size.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ describe("probeRegistrySize", () => {
probeRegistrySize("qwen3.5:9b", recorder.capture);
const [argv] = recorder.calls;
expect(argv[0]).toBe("curl");
expect(argv).toContain("-sf");
expect(argv).not.toContain("-sfL");
expect(argv[argv.length - 1]).toBe(
"https://registry.ollama.ai/v2/library/qwen3.5/manifests/9b",
);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/inference/ollama/model-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function probeRegistrySize(model: string, capture: CaptureFn = runCapture
[
"curl",
...buildValidatedCurlCommandArgs([
"-sfL",
"-sf",
"--max-time",
String(PROBE_TIMEOUT_SECONDS),
"-H",
Expand Down
Loading