Repository navigation
fix: 按 review 分批修复数据安全、健壮性、文档与工程化问题 - #4
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
按 review 缺陷表分 4 批修复(每批一个 commit,外加一个启动轮询回归修复)。
第 1 批 数据安全
RestoreBackup(path, crypto, key):未解锁直接拒绝;ZIP 先解压到临时目录,跳过locknote.db*/data_key_verifier/restore-snapshots;用当前 data key 解密校验所有.enc,校验失败则拒绝恢复(防止跨 vault 恢复导致正文无法解密);写入前生成restore-snapshots/<ts>快照,失败回滚;限制单文件、总大小和条目数量。HasMasterPassword() (bool, error),SaveMasterPassword拆为InsertMasterPassword/UpdateMasterPassword,不再INSERT OR REPLACE覆盖已有主密钥;IsFirstRun() (bool, error)。SetupPassword:后端校验displayKey;先写 verifier(原子写),再插入主密钥,插入失败时删除 verifier。internal/fsutil.WriteFileAtomic(同目录临时文件 → fsync → rename → 父目录 fsync)。registerEditorFlush/flushEditor:切换笔记、Cmd+L 锁定、窗口失焦/隐藏、关闭前都会 flush 防抖保存;WailsOnBeforeClose→app:before-close→ConfirmClose()(3s 超时兜底)。MainLayout加载笔记时用cancelled标记,避免旧请求覆盖新选中的笔记。第 2 批 健壮性
coreOrErr():core 未就绪时 API 返回错误,不再 nil panic。Exec错误,引入PRAGMA user_version;busy_timeout=5000+ WAL。mobileCallRead改用RLock;Markdown 链接:#内部跳转,http/https/mailto用BrowserOpenURL打开,其它 scheme 阻止;图片上限 50 MiB;导出文件名清理;Argon2 派生不再持有c.mu。EncryptedTitle == nil判断 fallback。第 3 批 性能与文档
notes.Service内容缓存(按 ID、更新时间、密文路径校验),锁定、恢复、导入、历史恢复后清空。第 4 批 工程化
ci.yml(Go vet/test、tsc、前端测试),release-v2.yml依赖它并使用go-version-file: go.mod、wails@v2.12.0;删除重复的release.yml。frontend/package.json版本统一为 1.0.9 并加testscript;删除未使用的EncryptFile/DecryptFile;移除被跟踪的.idea和build/bin;补 crypto/core/backup/database/fsutil/attachments 及前端测试。本 PR 不包含:元数据加密(只写文档说明)、恢复密钥派生算法变更(只做格式校验)、组件拆分、alert 改 toast、macOS Bundle ID 修改。
验证:
go vet ./internal/... .、go test ./internal/... .、go vet ./mobile、npx tsc --noEmit、TZ=Asia/Shanghai npm test(116/116)。没有在桌面端手动跑过 UI。Link to Devin session: https://app.devin.ai/sessions/d9ef026cb9244270a2d90f54f6d763a4
Open in Devin Desktop: https://app.devin.ai/desktop/session/d9ef026cb9244270a2d90f54f6d763a4?variant=devin
Requested by: @JackyZhang8