fix(security): 修复看板 XSS 注入、归档覆盖及打包外泄风险

- 增加 HTML 实体转义并过滤危险伪协议,重构为事件委托机制阻断 XSS
- 归档前增加目标文件冲突检测,防止静默覆盖历史笔记与哈希记录
- 新增 --metadata-only 隐私脱敏模式,并对已有项目 index.html 提供覆写保护

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czm
2026-09-08 16:39:30 +08:00
co-authored by Claude
parent 5c68ff670e
commit 89d074e275
4 changed files with 211 additions and 94 deletions
+6
View File
@@ -54,6 +54,12 @@ const archivedDir = join(agentNoteRoot, "archived", cls);
mkdirSync(archivedDir, { recursive: true });
const archivedPath = join(archivedDir, filename);
if (existsSync(archivedPath)) {
console.error(`Error: target archived note already exists at ${archivedPath}`);
console.error("Refusing to overwrite existing archived note. Please inspect and resolve name collision manually.");
process.exit(1);
}
writeFileSync(targetPath, updatedContent, "utf8");
renameSync(targetPath, archivedPath);
console.log(`Moved: ${relToRoot} -> archived/${cls}/${filename}`);