Skip to content

The open-source app everyone uses to manage agents at work

Allow custom markdown mention links in editor

dotta49ace2faf9d4
diff --git a/ui/src/components/MarkdownEditor.tsx b/ui/src/components/MarkdownEditor.tsx
index 0f6bd402bc..afbd29fc90 100644
--- a/ui/src/components/MarkdownEditor.tsx
+++ b/ui/src/components/MarkdownEditor.tsx
@@ -68,6 +68,12 @@ function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
+function isSafeMarkdownLinkUrl(url: string): boolean {
+ const trimmed = url.trim();
+ if (!trimmed) return true;
+ return !/^(javascript|data|vbscript):/i.test(trimmed);
+}
+
/* ---- Mention detection helpers ---- */
interface MentionState {
@@ -269,7 +275,7 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
listsPlugin(),
quotePlugin(),
tablePlugin(),
- linkPlugin(),
+ linkPlugin({ validateUrl: isSafeMarkdownLinkUrl }),
linkDialogPlugin(),
thematicBreakPlugin(),
codeBlockPlugin({