Skip to content

Commit cfaf9b7

Browse files
committed
feat(sanitize): enable input sanitation
Follows the docs to inject rehype-sanitze in the preview component: https://github.com/uiwjs/react-md-editor?tab=readme-ov-file#security
1 parent e05b715 commit cfaf9b7

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

components/hypercert/hypercert-minting-form/form-steps.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
X,
2222
} from "lucide-react";
2323
import { RefObject, useMemo, useState } from "react";
24+
import rehypeSanitize from "rehype-sanitize";
2425

2526
import CreateAllowlistDialog from "@/components/allowlist/create-allowlist-dialog";
2627
import ConnectDialog from "@/components/connect-dialog";
@@ -137,6 +138,9 @@ const GeneralInformation = ({ form }: FormStepsProps) => {
137138
commands.orderedListCommand,
138139
commands.codeBlock,
139140
]}
141+
previewOptions={{
142+
rehypePlugins: [[rehypeSanitize]],
143+
}}
140144
/>
141145
</div>
142146
</FormControl>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"react-hook-form": "^7.51.3",
7171
"react-markdown": "^9.0.3",
7272
"react-use": "^17.5.1",
73+
"rehype-sanitize": "^6.0.0",
7374
"remeda": "^2.0.3",
7475
"server-only": "^0.0.1",
7576
"sharp": "^0.33.5",

pnpm-lock.yaml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)