Use hex-encode DEK for keychain safety, prefer Wayland when available on Linux#22
Use hex-encode DEK for keychain safety, prefer Wayland when available on Linux#22Mooling0602 wants to merge 4 commits into
Conversation
|
在某些发行版(例如Arch Linux上)编译项目时会出现该错误: failed to bundle project `failed to run linuxdeploy`
Error failed to bundle project `failed to run linuxdeploy`
ELIFECYCLE Command failed with exit code 1.因此在 97b8074#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519 添加了 |
|
我这边核实了一下,现在不适合合并。主要有两个阻断问题:
另外两个建议:
我本地验证结果:
所以这个 PR 方向是对的,但需要先修掉旧 DEK 迁移问题和 fmt。 |
已尝试对以上问题进行修复:3a6c6f6 |
|
审核了当前 PR 头提交
我本地验证了:
|
- Detect AppImage via APPDIR env var and override its hardcoded GDK_BACKEND=x11 when a Wayland compositor is available, while still respecting explicit user-set GDK_BACKEND values. - Wrap the raw secret Vec<u8> in Zeroizing before copy_from_slice in the legacy binary DEK migration path to avoid leaving the plaintext key in unzeroed memory. Ref: QingJ01#22 (comment)
|
已针对两个问题进行了修复: 1. AppImage GDK_BACKEND 覆盖逻辑 通过 `APPDIR` 环境变量识别 AppImage 场景:当检测到 AppImage 注入的 `GDK_BACKEND=x11` 且 Wayland compositor 可用时,覆盖为 `wayland`。非 AppImage 场景下用户显式设置的 `GDK_BACKEND` 不受影响。 2. Legacy DEK 迁移路径 zeroize 在 `Ok(secret) if secret.len() == DEK_LEN` 分支中先用 `Zeroizing::new(secret)` 包裹 `get_secret()` 返回的 `Vec`,再执行 `copy_from_slice`,避免 raw DEK 经普通 drop 残留在未清零内存。 本地验证:
请再次审核,谢谢! |
|
感谢继续修复,之前提到的 legacy raw DEK 迁移和 AppImage 我这边又跑了一轮验证,当前还有一个阻断点:CI 的 clippy 会失败。仓库里会执行:
当前失败位置在
触发的是
另外两个非阻断建议:
我本地验证结果:
修掉 clippy 后我认为这个 PR 就比较接近可以合并了。 |
- Detect AppImage via APPDIR env var and override its hardcoded GDK_BACKEND=x11 when a Wayland compositor is available, while still respecting explicit user-set GDK_BACKEND values. - Wrap the raw secret Vec<u8> in Zeroizing before copy_from_slice in the legacy binary DEK migration path to avoid leaving the plaintext key in unzeroed memory. Ref: QingJ01#22 (comment)
9485fce to
0122229
Compare
- Hex-encode encryption key before persisting to OS keychain for better compatibility with string-based keychain backends - Auto-detect and migrate legacy binary-format entries on read - Conditionally set GDK_BACKEND=wayland when compositor is active, overriding AppImage GTK plugin's hardcoded x11 default - Disable binary stripping in Linux AppImage build Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Migrate legacy raw 32-byte DEK to hex encoding on read instead of discarding and regenerating, preserving existing encrypted data - Wrap hex-encoded DEK strings and decode buffers in Zeroizing - Only set GDK_BACKEND=wayland when no backend is explicitly configured, respecting user preference over the AppImage hardcoded default Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Detect AppImage via APPDIR env var and override its hardcoded GDK_BACKEND=x11 when a Wayland compositor is available, while still respecting explicit user-set GDK_BACKEND values. - Wrap the raw secret Vec<u8> in Zeroizing before copy_from_slice in the legacy binary DEK migration path to avoid leaving the plaintext key in unzeroed memory. Ref: QingJ01#22 (comment)
- Replace hex::encode(&*key) with hex::encode(&key[..]) to silence clippy::needless-borrows-for-generic-args on Zeroizing<[u8; 32]>. - Warn instead of silently ignoring set_secret failure in the legacy raw DEK migration path so broken writes are visible in logs. - Use GDK_BACKEND=wayland,x11 instead of pure wayland to preserve the X11 fallback when preferring Wayland on Linux. - Fix pre-existing clippy dead_code and needless_return warnings in the pebble crate that would fail CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0122229 to
1b5e9a8
Compare
|
有一个模块在修复时和主线发生了冲突,经过判断使用主线版本更为合适,故进行了调整并在rebase后重新强制推送(只影响修复分支)。 |
修复已基本完成,可以继续审查。 |
Summary 摘要
WAYLAND_DISPLAY时设置GDK_BACKEND=wayland,覆盖 AppImage GTK 插件硬编码的GDK_BACKEND=x11。不影响纯 X11 环境,同一个二进制包在两种显示协议下均可正常运行。NO_STRIP=1避免构建阶段 strip 失败。Changelog 变更详情
crates/pebble-crypto/src/keystore.rsdecode_hex()helper; constant32→DEK_LEN. DEK 存储前 hex 编码;读取时自动检测并迁移旧二进制格式;新增decode_hex()辅助函数;常量32→DEK_LENsrc-tauri/src/lib.rsGDK_BACKEND=waylandat startup when a Wayland compositor is detected; does not affect pure X11 environments. 启动时检测到 Wayland compositor 时设置GDK_BACKEND=wayland,不影响纯 X11 环境package.jsonNO_STRIP=1tobuild:linuxscript.build:linux脚本添加NO_STRIP=1Cargo.toml/crates/pebble-crypto/Cargo.tomlhex = "0.4"workspace dependency. 新增hex = "0.4"workspace 依赖Cargo.lockhexcrate. hex crate 锁定Test plan 测试计划
cargo build通过cargo test通过npm test通过GDK_BACKEND=wayland设置生效🤖 Generated with Claude Code