Decide "is this source crates.io" in one helper: CargoLock::entries uses a substring test that accepts index.crates.io.evil.example
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 50/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
[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.
- Vorherrschende Sprache
- Rust
- Sterne
- 9
- Forks
- 2
- Ø Merge
- 20 Std. 47 Min.
- Gemergte PRs (30 T.)
- 681
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
SocketDev/socket-patch#1860 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
SocketDev/socket-patch#1838 ·
Maintainer antworten meist innerhalb von 1 Tag
-
arch-audit refactor
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 54/100
SocketDev/socket-patch#1993 ·
Maintainer antworten meist innerhalb von 1 Tag
-
arch-audit refactor
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 66/100
SocketDev/socket-patch#1992 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
SocketDev/socket-patch#1987 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in SocketDev/socket-patch
Ähnliche Issues
-
parity priority: low
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 65/100
storytold/vectorcraft#5421 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug enchantments Java Edition protocol
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
Pumpkin-MC/Pumpkin#4465 ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
vfarcic/dot-agent-deck#2079 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
fraiseql/fraisier-core#148 ·
Maintainer antworten meist innerhalb von 1 Tag