Skip to content

Commit 01a9083

Browse files
committed
🔒 Escape attribute-view field names in sort menu options to prevent stored XSS GHSA-g3jx-227v-x2x4
1 parent fed29dc commit 01a9083

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/src/protyle/render/av/sort.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {getColIconByType} from "./col";
33
import {transaction} from "../../wysiwyg/transaction";
44
import {setPosition} from "../../../util/setPosition";
55
import {unicode2Emoji} from "../../../emoji";
6+
import {escapeHtml} from "../../../util/escape";
67
import {getFieldsByData} from "./view";
78
import {Constants} from "../../../constants";
89

@@ -119,7 +120,7 @@ export const getSortsHTML = (columns: IAVColumn[], sorts: IAVSort[]) => {
119120
const genSortItem = (id: string) => {
120121
let sortHTML = "";
121122
columns.forEach((item) => {
122-
sortHTML += `<option value="${item.id}" ${item.id === id ? "selected" : ""}>${item.icon && unicode2Emoji(item.icon)}${item.name}</option>`;
123+
sortHTML += `<option value="${item.id}" ${item.id === id ? "selected" : ""}>${item.icon && unicode2Emoji(item.icon)}${escapeHtml(item.name)}</option>`;
123124
});
124125
return sortHTML;
125126
};

0 commit comments

Comments
 (0)