An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:memo: Document threat model and password-change semantics for encrypted notebooks https://github.com/siyuan-note/siyuan/issues/18034
Daniel4e66c1405215
diff --git a/docs/ENCRYPTED-NOTEBOOK.md b/docs/ENCRYPTED-NOTEBOOK.mdindex 76c3a5c65f..3fc222f7a3 100644--- a/docs/ENCRYPTED-NOTEBOOK.md+++ b/docs/ENCRYPTED-NOTEBOOK.md@@ -262,10 +262,10 @@ Encrypted notebooks forbid moving documents across the encrypted boundary (norma- BoxConf.WrappedDEK (ciphertext, requires KEK to unwrap)- DEK / plaintext caches in memory (cleared on lock)- The content field of history indexes (left empty; neither plaintext nor ciphertext)+- **Metadata leakage** (encryption does not conceal): file count, directory structure, file sizes, modification times (mtime), asset file extensions, blockID timestamps. Encrypted-box asset filenames are desensitized to `uuid-blockID.ext` but the extension is visible; old ciphertext retained in sync endpoints or historical snapshots is held by those storage providers, and the encrypted notebook cannot revoke their copies.**API protection**:-- `/api/file/getFile`: refuses to read encrypted-box .sy (ciphertext is meaningless; prevents plugin mis-parsing)-- `/api/file/putFile`: refuses to write encrypted-box .sy (plaintext writes corrupt the ciphertext format)+- `/api/file/getFile`, `/api/file/putFile`, `/api/file/copyFile`, `/api/file/renameFile`, `/api/file/removeFile`: refuse to read/write any file under an encrypted box (not just .sy), preventing ciphertext leakage or plaintext corruption; legitimate reads/writes go through dedicated APIs (encryption-aware).## 13. AI / LLM Reachability@@ -325,6 +325,8 @@ An encrypted notebook is an island; some features are unimplemented because of t### Changing the master passwordGo to **Settings → Access authorization → Change master password**. Changing the password only re-wraps each box's WrappedDEK — **document data is not re-encrypted**, so it completes instantly. The key backup is auto-refreshed and synced after a password change.+> Important semantics: password change uses the KEK envelope model — the DEK itself does not change; only a new KEK (derived from the new password) re-wraps the WrappedDEK. This means **changing the password does not revoke the old password's decryption ability**: if the old password and an old WrappedDEK (retained in sync endpoints, backups, or historical snapshots) leak together, the same DEK can still be unwrapped, decrypting current data. If you suspect the old password has leaked, migrate content to a freshly created encrypted notebook (new DEK) rather than just changing the password.+### Multi-device syncEncrypted-notebook ciphertext `.sy`/assets/database files sync along with the data (ciphertext in, ciphertext out, self-consistent); the global key material (MasterSalt etc.) is also automatically backed up to the sync directory. **No manual "enable" is needed on a new device after sync**:diff --git a/docs/ENCRYPTED-NOTEBOOK.zh-CN.md b/docs/ENCRYPTED-NOTEBOOK.zh-CN.mdindex f33b8d0e46..feffadc573 100644--- a/docs/ENCRYPTED-NOTEBOOK.zh-CN.md+++ b/docs/ENCRYPTED-NOTEBOOK.zh-CN.md@@ -262,10 +262,10 @@ MasterSalt 是 KEK 派生的全局根基——主密码 + MasterSalt 经 Argon2i- BoxConf.WrappedDEK(密文,需 KEK 解开)- 内存中的 DEK/明文缓存(锁定时清空)- 历史索引的 content 字段(留空,不存明文也不存密文)+- **元数据泄漏**(加密不掩盖以下信息):文件数量、目录结构、文件大小、修改时间(mtime)、asset 文件扩展名、blockID 时间戳。加密 box 的 asset 文件名虽脱敏为 `uuid-blockID.ext`,但扩展名可见;同步端/历史快照中的旧密文也由各存储方自行保管,加密 notebook 无法吊销其副本**API 防护**:-- `/api/file/getFile`:拒绝读取加密 box 的 .sy(密文无意义,防止插件误解析)-- `/api/file/putFile`:拒绝写入加密 box 的 .sy(明文写入会破坏密文格式)+- `/api/file/getFile`、`/api/file/putFile`、`/api/file/copyFile`、`/api/file/renameFile`、`/api/file/removeFile`:拒绝读写加密 box 下的任何文件(不只 .sy),避免密文泄漏或明文破坏;合法读写走专用 API(已加密感知)## 13. AI / LLM 可达性@@ -325,6 +325,8 @@ MasterSalt 是 KEK 派生的全局根基——主密码 + MasterSalt 经 Argon2i### 修改主密码进入 **设置 → 访问授权 → 修改主密码**。改密只需重新包络各 box 的 WrappedDEK,**不重新加密文档数据**,因此即时完成。改密后密钥备份会自动刷新并同步。+> 重要语义:改密采用 KEK 包络模式——DEK 本身不变,只是用新主密码派生的新 KEK 重新包络 WrappedDEK。这意味着**改密不能吊销旧主密码的解密能力**:如果旧主密码和旧 WrappedDEK(如同步端、备份、历史快照中保留的)同时泄露,仍能解出同一个 DEK,进而解当前数据。如果怀疑旧主密码已泄露,应迁移内容到新建的加密笔记本(新 DEK)而非仅改密。+### 多设备同步加密笔记本的密文 `.sy`/assets/数据库文件会随数据同步(密文进密文出,闭环自洽);全局密钥材料(MasterSalt 等)也会自动备份到同步目录。**新设备同步后无需手动"启用"**: