Serialize patch vulnerabilities through one helper; get's selectionRequired options[] are unsorted and drop description
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with crates/socket-patch-cli/src/commands/agent_download.rs, list.rs, get.rs, and json_envelope.rs; compare the three vulnerability serializers and inspect select_json_mode_multi_free_options_serialize_vulnerabilities in get.rs. Run that test, then update it to assert that options contain vulnerabilities sorted by id with descriptions; confirm the other JSON outputs stay unchanged except for any deliberate severity field addition.
由索引模型根据 Issue 内容生成。
描述
[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.
Kind: refactor (with a small output fix). Register ID: T02.
Problem
The per-vulnerability JSON object {id, cves, severity, summary, description} is built by hand in three places, and the copies have drifted:
agent_download::patch_event_metadataL119-L141 includesdescriptionand sorts by id. Its comment notes that "HashMap iteration is otherwise nondeterministic and consumers diff this output".list.rsL172-L192 builds the same shape from aPatchRecord, sorted and withdescription, but it omits the top-levelseveritythatpatch_event_metadataemits.get.rsL767-L790, theselectionRequiredoptions[], iteratesp.vulnerabilities(aHashMap) unsorted and omitsdescription.
So get --json <CVE> with several free options lists each option's vulnerabilities in a different order from run to run. The test that claims to cover this, select_json_mode_multi_free_options_serialize_vulnerabilities (get.rs L4898), only asserts Err(1), so the drift went unnoticed.
Proposed change
- Add one
#[derive(Serialize)]vulnerability view, or a singlevuln_json(id, &v)helper, injson_envelope.rs. It returns the list sorted by id. - Use it from all three sites.
- Decide in the PR whether
listgains the top-levelseverity, and say so in the PR description.
Size
3 to 4 files. About −40 / +30 lines.
Acceptance criteria
scan/geteventdetailsandlist --jsonare byte-identical before and after, apart from any field the PR deliberately adds.get'soptions[].vulnerabilitiesis sorted by id and carriesdescription.- The fake test above captures the envelope and asserts the sorted
options[].vulnerabilities.
- 主要语言
- Rust
- 星标
- 9
- 派生
- 2
- 平均合并
- 20 小时 47 分钟
- 30 天内合并 PR
- 681
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SocketDev/socket-patch 的其他 Issue
-
agent:triaged arch-audit priority:p3 refactor
难度 2/5 1-3 小时 新手友好度 83/100
SocketDev/socket-patch#1860 ·
维护者通常 1 天内回复
-
agent:triaged arch-audit priority:p3 refactor
难度 2/5 1-3 小时 新手友好度 78/100
SocketDev/socket-patch#1838 ·
维护者通常 1 天内回复
-
arch-audit refactor
难度 4/5 3-5 天 新手友好度 54/100
SocketDev/socket-patch#1993 ·
维护者通常 1 天内回复
-
arch-audit refactor
难度 3/5 1-2 天 新手友好度 66/100
SocketDev/socket-patch#1992 ·
维护者通常 1 天内回复
-
agent:triaged arch-audit priority:p3 refactor
难度 4/5 3-5 天 新手友好度 35/100
SocketDev/socket-patch#1987 · 1 条评论 ·
维护者通常 1 天内回复
查看 SocketDev/socket-patch 的全部 Issue
相似的 Issue
-
Perl - Readme Drift可能已有人在做 @Omnideth 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
CommunityToolkit/Aspire#2375 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复