fix: Whitelist fields in URL unfurl presenter (#13254)

Restores field-level picking in presentURL instead of casting the entire
UnfurlData blob, so transient metadata attached by unfurl plugins or
internal callers is never serialized into API responses.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-08-02 07:41:50 -04:00
committed by GitHub
co-authored by Claude Opus 5
parent 0e7c4bc756
commit 257c2bfdc0
+13 -2
View File
@@ -33,8 +33,19 @@ async function presentUnfurl(
}
}
const presentURL = (data: UnfurlData): UnfurlResponse[UnfurlResourceType.URL] =>
data as UnfurlResponse[UnfurlResourceType.URL]; // this would have been transformed by the unfurl plugin.
// The data will have been transformed by the unfurl plugin, fields are picked
// individually so that additional metadata is never exposed in the response.
const presentURL = (
data: UnfurlData
): UnfurlResponse[UnfurlResourceType.URL] => ({
type: UnfurlResourceType.URL,
url: data.url,
title: data.title,
description: data.description,
color: data.color,
thumbnailUrl: data.thumbnailUrl,
faviconUrl: data.faviconUrl,
});
const presentMention = async (
data: UnfurlData,