Skip to content

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

:lock: Escape bazaar package and notebook names in confirmation dialogs https://github.com/siyuan-note/siyuan/security/advisories/GHSA-hvwp-43j9-4xgf

Daniel6280b0280cd3
diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts
index bc461a7f24..65ffa63cc3 100644
--- a/app/src/config/bazaar.ts
+++ b/app/src/config/bazaar.ts
@@ -1975,7 +1975,7 @@ type="checkbox">
if (response.code !== 0) {
if (data?.reason === "package-exists" && data.packageName) {
confirmDialog("⚠️ " + window.siyuan.languages.update,
- window.siyuan.languages.confirmOverwriteLocalBazaarPackage.replace("${name}", data.packageName), () => {
+ window.siyuan.languages.confirmOverwriteLocalBazaarPackage.replace("${name}", escapeHtml(data.packageName)), () => {
bazaar._installLocalPackage(file, app, true);
});
} else if (data?.reason === "package-incompatible") {
@@ -2312,7 +2312,7 @@ type="checkbox">
widgets: "/api/bazaar/uninstallBazaarWidget",
};
const uninstallName = installedItem.name;
- confirmDialog("⚠️ " + window.siyuan.languages.uninstall, window.siyuan.languages.confirmUninstall.replace("${name}", uninstallName), () => {
+ confirmDialog("⚠️ " + window.siyuan.languages.uninstall, window.siyuan.languages.confirmUninstall.replace("${name}", escapeHtml(uninstallName)), () => {
fetchPost(uninstallAPI[pkgType], {
packageName: uninstallName,
keyword: (bazaar.element.querySelector(`.config-bazaar__panel[data-type="${bazaar._type2tabType(pkgType)}"] .b3-text-field`) as HTMLInputElement).value,
diff --git a/app/src/util/mount.ts b/app/src/util/mount.ts
index f099684a6c..23f4819a43 100644
--- a/app/src/util/mount.ts
+++ b/app/src/util/mount.ts
@@ -5,6 +5,7 @@ import {fetchPost, fetchSyncPost} from "./fetch";
import {Dialog} from "../dialog";
import {getOpenNotebookCount} from "./pathName";
import {replaceFileName, validateName} from "../editor/rename";
+import {escapeHtml} from "../util/escape";
import {setStorageVal} from "../protyle/util/compatibility";
import {openFileById} from "../editor/util";
import {openMobileFileById} from "../mobile/editor";
@@ -362,7 +363,7 @@ export const openEncryptedNotebook = (app: App, notebookId: string, name: string
return;
}
const dialog = new Dialog({
- title: window.siyuan.languages.unlockEncryptedNotebook.replace("${x}", name),
+ title: window.siyuan.languages.unlockEncryptedNotebook.replace("${x}", escapeHtml(name)),
content: `<div class="b3-dialog__content">
<input type="password" placeholder="${window.siyuan.languages.masterPassword}" class="b3-text-field fn__block">
<div class="fn__hr--b"></div>