Skip to content

Commit 24f05df

Browse files
committed
fix(sec): embed-block の src 属性検証を強化
- embed-block において、`src` 属性が `https://` で始まるかを大文字・小文字を区別せずチェックするように
1 parent 66e9c67 commit 24f05df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/render/src/elements/embed-block.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ const purify = DOMPurify(window);
7676
// Add hook to validate src attribute (only allow https://)
7777
purify.addHook("uponSanitizeAttribute", (_node, data) => {
7878
if (data.attrName === "src" && data.attrValue) {
79-
if (!data.attrValue.startsWith("https://")) {
79+
// Case-insensitive check for https:// scheme
80+
if (!data.attrValue.toLowerCase().startsWith("https://")) {
8081
data.attrValue = "";
8182
data.forceKeepAttr = false;
8283
}

0 commit comments

Comments
 (0)