Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lock: Escape attribute-view field names in sort menu options to prevent stored XSS https://github.com/siyuan-note/siyuan/security/advisories/GHSA-g3jx-227v-x2x4

Daniel01a9083e7da8
diff --git a/app/src/protyle/render/av/sort.ts b/app/src/protyle/render/av/sort.ts
index 1f89bcb4b1..3050b52db9 100644
--- a/app/src/protyle/render/av/sort.ts
+++ b/app/src/protyle/render/av/sort.ts
@@ -3,6 +3,7 @@ import {getColIconByType} from "./col";
import {transaction} from "../../wysiwyg/transaction";
import {setPosition} from "../../../util/setPosition";
import {unicode2Emoji} from "../../../emoji";
+import {escapeHtml} from "../../../util/escape";
import {getFieldsByData} from "./view";
import {Constants} from "../../../constants";
@@ -119,7 +120,7 @@ export const getSortsHTML = (columns: IAVColumn[], sorts: IAVSort[]) => {
const genSortItem = (id: string) => {
let sortHTML = "";
columns.forEach((item) => {
- sortHTML += `<option value="${item.id}" ${item.id === id ? "selected" : ""}>${item.icon && unicode2Emoji(item.icon)}${item.name}</option>`;
+ sortHTML += `<option value="${item.id}" ${item.id === id ? "selected" : ""}>${item.icon && unicode2Emoji(item.icon)}${escapeHtml(item.name)}</option>`;
});
return sortHTML;
};