From aeb96018d7187d1bd475c93f5c8ae6e79146d515 Mon Sep 17 00:00:00 2001
From: Kalle <38327916+Sendouc@users.noreply.github.com>
Date: Tue, 8 Sep 2026 21:24:14 +0300
Subject: [PATCH] Allowlist markdown tags
---
app/components/Markdown.test.tsx | 123 +++++++++++++++++
app/components/Markdown.tsx | 43 +++---
app/utils/markdown-html.test.ts | 156 +++++++++++++++++++++
app/utils/markdown-html.ts | 224 +++++++++++++++++++++++++++++++
4 files changed, 531 insertions(+), 15 deletions(-)
create mode 100644 app/components/Markdown.test.tsx
create mode 100644 app/utils/markdown-html.test.ts
create mode 100644 app/utils/markdown-html.ts
diff --git a/app/components/Markdown.test.tsx b/app/components/Markdown.test.tsx
new file mode 100644
index 000000000..49756c52e
--- /dev/null
+++ b/app/components/Markdown.test.tsx
@@ -0,0 +1,123 @@
+import { renderToStaticMarkup } from "react-dom/server";
+import { describe, expect, test } from "vitest";
+import { Markdown } from "./Markdown";
+
+function render(markdown: string) {
+ return renderToStaticMarkup({markdown});
+}
+
+describe("Markdown", () => {
+ test.each([
+ {
+ why: "meta refresh redirect",
+ markdown: `hi there`,
+ forbidden: "[x](/relative)`,
+ forbidden: "`,
+ forbidden: "`,
+ forbidden: "`,
+ forbidden: "