M004#27
Open
Ink-dark wants to merge 27 commits into
Open
Conversation
合并,暂停M003 沙箱开发
- 在 BroadcastChannel::broadcast 方法中添加消息过期检查,避免发送无效消息 - 将签名算法从 AES-GCM 加密改为 HMAC-SHA256 专门签名算法,提高安全性 - 添加 hmac 和 sha2 依赖 - 更新 IpcSecurity 结构体,添加独立的 signature_key 字段 - 清理未使用的 MessageSignature 结构体和变量
将消息年龄检查逻辑从 validate_message 提取到独立的 check_message_age 方法以提高代码可维护性。 同时修复解密时硬编码的标签长度,改为使用 AES_256_GCM.tag_len() 获取实际标签长度。
避免在每次循环迭代中克隆消息,改为在循环外克隆一次
修改is_expired方法返回Result类型以处理系统时间错误 添加TimeError枚举类型用于表示系统时间错误 更新相关调用点处理可能的错误情况
将 TimeError 改为包含详细错误信息 提取重复的过期检查逻辑到共享方法 添加中文注释说明安全验证逻辑
在检查IPC消息过期时间时,使用checked_add替代直接加法运算,避免潜在的整数溢出问题。当检测到溢出时返回错误而非静默处理。
添加hkdf依赖并实现从主密钥派生独立加密和签名密钥的功能,增强安全性
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.
从 989ffad 到 5f2d45d 的修改总结,共 13 个提交
1. feat(M004): 添加零拷贝消息类型和通道管理器 (ddd3372)
bytes::Bytes实现零拷贝传输2. test(M004): 添加IPC模块单元测试 (c4a0142)
3. docs(M004): 更新开发日志 (fa3989d)
4. fix(M004): 修复通道管理器错误处理和会话令牌验证漏洞 (7c8598d)
5. fix(M004): 修复BroadcastChannel广播逻辑错误和add_receiver返回类型 (6a4a060)
6. fix(M004): 修复generate_session_token中的unwrap调用 (684da5c)
7. fix(M004): 改进receive_with_timeout通道断开时的错误信息 (f6f0b3f)
8. fix(M004): 修复get_receiver_count方法中的unwrap调用 (00083d8)
9. fix(M004): 将连接劫持检测的时间阈值改为可配置参数 (66ce973)
10. fix(M004): 修复签名验证逻辑,将nonce与签名一起存储和传输 (a1be48b)
11. fix(M004): 在validate_message中添加max_message_age_seconds检查 (018a259)
12. fix(M004): 改进锁中毒错误信息和签名验证逻辑 (68b0d1e)
13. fix(M004): 为ZeroCopyMessage添加序列化支持 (5f2d45d)
主要改进