From 4c5754de473d0d887f217db28f94c53a000bc559 Mon Sep 17 00:00:00 2001 From: Sravanjangam <163002695+Sravanjangam@users.noreply.github.com> Date: Sun, 23 Aug 2026 03:25:54 +0530 Subject: [PATCH] fix(raycast): only offer http(s) URLs from server-controlled metadata metadata.url arrives from the API and can originate in third-party ingested content shared into a container. extractUrl now parses the value and only returns it for https:/http: schemes, so javascript:, file:, and arbitrary app-handler URLs never reach Action.OpenInBrowser and the OS opener. --- apps/raycast-extension/src/search-memories.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/raycast-extension/src/search-memories.tsx b/apps/raycast-extension/src/search-memories.tsx index dbc47ceb7..fcc495d21 100644 --- a/apps/raycast-extension/src/search-memories.tsx +++ b/apps/raycast-extension/src/search-memories.tsx @@ -42,7 +42,18 @@ const extractContent = (memory: SearchResult) => { const extractUrl = (memory: SearchResult) => { if (memory.metadata?.url && typeof memory.metadata.url === "string") { - return memory.metadata.url + const url = memory.metadata.url + // Server-controlled value: only offer http(s). Without a scheme + // allowlist, a crafted memory could hand javascript:, file:, or + // arbitrary app-handler URLs to the OS opener. + try { + const parsed = new URL(url) + if (parsed.protocol === "https:" || parsed.protocol === "http:") { + return url + } + } catch { + return null + } } return null }