experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ipc): sanitize window params to prevent serialization crash

The window-list IPC handler was passing raw params objects which could
contain non-serializable values (functions, native objects, circular
refs). V8's ValueSerializer would crash with SIGSEGV when trying to
serialize these.

Now only primitive types and arrays of primitives are included in the
response.

+17 -1
+17 -1
backend/electron/ipc.ts
··· 2310 2310 continue; 2311 2311 } 2312 2312 2313 + // Sanitize params to only include serializable values 2314 + // (avoid functions, native objects, circular refs that crash IPC) 2315 + const safeParams: Record<string, unknown> = {}; 2316 + for (const [key, value] of Object.entries(winData.params)) { 2317 + const type = typeof value; 2318 + if (type === 'string' || type === 'number' || type === 'boolean' || value === null) { 2319 + safeParams[key] = value; 2320 + } else if (Array.isArray(value)) { 2321 + // Only include arrays of primitives 2322 + if (value.every(v => typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null)) { 2323 + safeParams[key] = value; 2324 + } 2325 + } 2326 + // Skip functions, objects, etc. that may not serialize safely 2327 + } 2328 + 2313 2329 windows.push({ 2314 2330 id, 2315 2331 url, 2316 2332 title: win.getTitle(), 2317 2333 source: winData.source, 2318 - params: winData.params 2334 + params: safeParams 2319 2335 }); 2320 2336 } 2321 2337 }