diff --git a/src/browser/features/Tools/WebFetchToolCall.tsx b/src/browser/features/Tools/WebFetchToolCall.tsx index 3727b9b392..76805172fd 100644 --- a/src/browser/features/Tools/WebFetchToolCall.tsx +++ b/src/browser/features/Tools/WebFetchToolCall.tsx @@ -35,6 +35,18 @@ interface NormalizedResult { error?: string; } +/** + * Allowlist http/https for clickable hrefs. Blocks javascript:, data:, vbscript:, etc. + */ +function isSafeHref(url: string): boolean { + try { + const protocol = new URL(url).protocol; + return protocol === "http:" || protocol === "https:"; + } catch { + return false; + } +} + /** * Extract domain from URL for compact display */ @@ -144,14 +156,18 @@ export const WebFetchToolCall: React.FC = ({
URL: - - {args.url} - + {isSafeHref(args.url) ? ( + + {args.url} + + ) : ( + {args.url} + )}
{normalized?.success && normalized.title && (