Hosted composer.lock rewrite splices the server's url and sha1 through expanding Regex::replace with no validation or JSON escaping
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- build-system, security
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[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.
- Lenguaje dominante
- Rust
- Estrellas
- 9
- Forks
- 2
- Merge medio
- 20 h 47 min
- PR fusionados (30 d)
- 681
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SocketDev/socket-patch#1860 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
SocketDev/socket-patch#1838 ·
Los mantenedores suelen responder en 1 día
-
arch-audit refactor
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
SocketDev/socket-patch#1993 ·
Los mantenedores suelen responder en 1 día
-
arch-audit refactor
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
SocketDev/socket-patch#1992 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
SocketDev/socket-patch#1987 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de SocketDev/socket-patch
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
riverqueue/river#1576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
stadelmanma/fitparse-rs#64 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
zed-extensions/java#325 ·
-
Suggestion: full-band strip — mark the tuned frequency in magenta, with triangles on the edgesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
dividebysandwich/sdroxide#769 ·
Los mantenedores suelen responder en 5 días