[Hardening] Reject non-object JSON notifications without panicking (F-008)
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- networking, security
调研方向
从 raw_client.rs 第764–773行附近开始,这里是通知路径读取 JSON 响应字段的位置。检查非对象 JSON 值的处理方式,然后为标量、数组和 null 通知添加回归测试。完成标准是:无效的通知形状会返回正常的协议错误或解析错误,而不会 panic;同时,null 负对照仍允许 ping 完成。
由索引模型根据 Issue 内容生成。
描述
Summary
In rust-electrum-client 0.25.2 (reported upstream commit 7c1d759e2789b5e46fcae1525ab06ff4012bc668), the reader notification path accesses resp["method"].take(). A server-pushed JSON scalar without an id is treated as a notification, but mutable indexing a scalar JSON value panics. A malicious or compromised Electrum server (or an attacker able to alter the Electrum connection) can therefore cause client/wallet availability loss in a release build.
Reproduction
- Build the client in release mode.
- Negotiate protocol version 1.4.
- While a request is in flight, send this line:
5
Observed:
serde_json panic: cannot access key "method" in JSON number
A null notification was tested as a negative control and the subsequent ping completed normally.
Source
Reported source location: raw_client.rs lines 764–773 (in the affected revision).
Suggested hardening
- Require a JSON object before reading notification fields, or use non-panicking accessors such as get("method").
- Return a normal protocol/parse error for invalid notification shapes.
- Add regression tests for scalar, array, and null notifications.
This is a hardening issue: the demonstrated impact is availability loss in release mode; no fund or privacy compromise was observed.
- 主要语言
- Rust
- 星标
- 89
- 派生
- 87
- 平均合并
- 1 小时 25 分钟
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitcoindevkit/rust-electrum-client 的其他 Issue
-
[Hardening] Validate legacy block_headers length before slicing (F-007)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 82/100
bitcoindevkit/rust-electrum-client#221 · 1 条评论 ·
-
use-rustls-ring transitively enables rustls/default (aws-lc-rs), breaking ring-only builds可能已有人在做 @EddieHouston 于 130 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
-
discussion new feature
难度 4/5 3-5 天 新手友好度 48/100
bitcoindevkit/rust-electrum-client#211 · 2 条评论 ·
-
Rework CI to use `cargo-rbmt`可能重新可做 @luisschwab 于 205 天前认领,目前没有进行中的 PR。 未关闭
bitcoindevkit/rust-electrum-client#202 · 已指派 1 人 ·
查看 bitcoindevkit/rust-electrum-client 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
swc-project/swc-ai-issues#164 ·
-
难度 2/5 1-3 小时 新手友好度 85/100
pop-os/cosmic-player#367 ·
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
servo/rust-smallvec#873 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
messense/dav-server-rs#82 ·
维护者通常 1 天内回复