Hosted composer.lock rewrite splices the server's url and sha1 through expanding Regex::replace with no validation or JSON escaping
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- build-system, security
Direzione di ricerca
Start in formats/composer/hosted.rs around L268-L281, where the url and sha1 are spliced into the rewritten composer.lock through regex replacement, then check the vendored-path test at L232-L233. Compare the sha1 check in patch/redirect/mod.rs near L1988 and the parse_vendor_path helper used by wired_to. Done means a url containing $1 and a quote produces valid JSON with the exact url, and a non-hex sha1 is refused with a warning, with the existing composer equivalence tests still passing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[agent] Filed by the scheduled architecture audit (audit-core). Register: register.
Kind: bug (missing validator; extends A06). Register ID: A56.
Problem
formats/composer/hosted.rs L268-L281 builds the replacement text from server-supplied values:
rewritten = url_re.replace(&rewritten, format!("${{1}}{}${{2}}", dep.artifact_url).as_str())
...
shasum_re.replace(&rewritten, format!("${{1}}{sha1}${{2}}").as_str())
- The replacer expands
$n/${name}inside the url and the sha1. - Neither value is JSON-escaped.
- The sha1 is never checked to be 40 lowercase hex.
The cargo hosted path does validate its checksum (redirect/mod.rs L1988).
Executed (a scratch copy at cbbbdb9): url …?s=$1&q="z with sha1 not"hex$2 produces "url": "https://h.test/x?s="url": "&q="z", and the rewritten composer.lock no longer parses as JSON.
The vendored check at L232-L233 is a hand-rolled ".socket/vendor/" prefix test, where mod.rs's wired_to uses parse_vendor_path.
Proposed change
- Refuse the dep unless
digest::sha1_hex-style validation passes. - Serialize the url with
serde_json::to_stringand splice it withregex::NoExpand. - Use
parse_vendor_pathfor the vendored check.
Size
1 file, about ±25 lines, plus 2 tests.
Acceptance criteria
- New tests: a url containing
$1and"round-trips to valid JSON with the exact url, and a non-hex sha1 is refused with a warning code. - Composer equivalence tests pass.
- Lingua principale
- Rust
- Stelle
- 9
- Fork
- 2
- Merge medio
- 20h 47m
- PR unite (30g)
- 681
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
SocketDev/socket-patch#1860 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged arch-audit priority:p3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SocketDev/socket-patch#1838 ·
I maintainer di solito rispondono entro 1 giorno
-
arch-audit refactor
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
SocketDev/socket-patch#1993 ·
I maintainer di solito rispondono entro 1 giorno
-
arch-audit refactor
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
SocketDev/socket-patch#1992 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged arch-audit priority:p3 refactor
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
SocketDev/socket-patch#1987 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SocketDev/socket-patch
Issue simili
-
A-linter
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
oxc-project/oxc#28783 ·
I maintainer di solito rispondono entro 1 giorno
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/datafusion#27059 ·
I maintainer di solito rispondono entro 1 giorno
-
Bump calamine to 0.38: RUSTSEC-2026-0436 (CFB/OLE2 panic and unbounded allocation) fails cargo auditAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
docling-project/docling.rs#979 ·
I maintainer di solito rispondono entro 1 giorno
-
llm translation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno