mirror of
https://github.com/czm15053/write-notes-like-deepseek
synced 2026-12-06 07:00:29 +08:00
fix(security): 修复看板 XSS 注入、归档覆盖及打包外泄风险
- 增加 HTML 实体转义并过滤危险伪协议,重构为事件委托机制阻断 XSS - 归档前增加目标文件冲突检测,防止静默覆盖历史笔记与哈希记录 - 新增 --metadata-only 隐私脱敏模式,并对已有项目 index.html 提供覆写保护 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user