Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(plugin-net): narrow binary response limit input

鱼骨头TOf36d97eafa3a
diff --git a/apps/desktop/electron/main/plugin-net-fetch.ts b/apps/desktop/electron/main/plugin-net-fetch.ts
index 0147dd17a..ba4ac0eab 100644
--- a/apps/desktop/electron/main/plugin-net-fetch.ts
+++ b/apps/desktop/electron/main/plugin-net-fetch.ts
@@ -23,7 +23,7 @@ function parseResponseType(value: unknown): "text" | "base64" {
function parseResponseLimit(value: unknown, responseType: "text" | "base64"): number {
if (value === undefined) return MAX_PLUGIN_BINARY_RESPONSE_BYTES;
- if (responseType !== "base64" || !Number.isSafeInteger(value) || value < 1 || value > MAX_PLUGIN_BINARY_RESPONSE_BYTES) {
+ if (responseType !== "base64" || typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > MAX_PLUGIN_BINARY_RESPONSE_BYTES) {
throw failure("INVALID_ARGUMENT", "maxResponseBytes is only supported for bounded base64 responses");
}
return value;