Decide "is this source crates.io" in one helper: CargoLock::entries uses a substring test that accepts index.crates.io.evil.example
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 50/100
Hướng nghiên cứu
Start with CargoLock::entries in crates/socket-patch-core/src/formats/cargo/mod.rs (around L483) and add a failing unit test with the index.crates.io.evil.example and github.com/rust-lang/crates.io-index-fork lookalikes. Then read the other three sites: vendor/cargo.rs (L576), patch/redirect/mod.rs (L2451), vendor/cargo_manifest.rs (L78), plus the CRATES_IO_SOURCE const in redirect/upstream/cargo.rs. Done means one is_crates_io_source helper is called from all four sites, the local copies are gone, and the cargo lock and vendor cargo tests pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Filed by the scheduled architecture audit (audit-core). Register: register.
Kind: bug (duplicated rule that drifted). Register ID: A55.
Problem
Whether a Cargo.lock source is crates.io is decided in four places, by three different rules:
| Site | Rule |
|---|---|
formats/cargo/mod.rs L483-L484 (CargoLock::entries) |
substring: source.contains("github.com/rust-lang/crates.io-index") || source.contains("index.crates.io") |
vendor/cargo.rs L576-L577 |
two exact strings |
patch/redirect/mod.rs L2451-L2461 |
normalized (case, registry+/sparse+, trailing /, .git) |
vendor/cargo_manifest.rs L78-L87 |
the [patch]-key variant |
There is also a CRATES_IO_SOURCE const in redirect/upstream/cargo.rs L25.```
Executed (a scratch copy at cbbbdb9): a lock entry with source = "sparse+https://index.crates.io.evil.example/" gets SourceKind::CratesIo and a Sha256Hex verifier from CargoLock::entries. Downstream, VEX discovery treats it as crates.io (vex/discover/mod.rs L2942).
Proposed change
Add one formats::cargo::is_crates_io_source(&str) -> bool next to is_registry_source. It uses the normalized rule from redirect/mod.rs, plus the [patch]-key spelling. Call it from all four sites, and delete the local copies and CRATES_IO_SOURCE.
Size
5 files, about −30/+20 lines.
Acceptance criteria
- A unit table test covers both canonical spellings, case and trailing-slash variants, and the
index.crates.io.evil.exampleandgithub.com/rust-lang/crates.io-index-forklookalikes (both rejected). - The cargo lock equivalence tests and vendor cargo tests pass.
- Ngôn ngữ chính
- Rust
- Star
- 9
- Fork
- 2
- Merge trung bình
- 20 giờ 47 phút
- Pull request đã merge (30 ngày)
- 681
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
SocketDev/socket-patch#1860 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit priority:p3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SocketDev/socket-patch#1838 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
arch-audit refactor
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
SocketDev/socket-patch#1993 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
arch-audit refactor
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
SocketDev/socket-patch#1992 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit priority:p3 refactor
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
SocketDev/socket-patch#1987 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
A-linter
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
oxc-project/oxc#28783 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apache/datafusion#27059 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bump calamine to 0.38: RUSTSEC-2026-0436 (CFB/OLE2 panic and unbounded allocation) fails cargo auditĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
docling-project/docling.rs#979 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày