You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hosted composer.lock rewrite splices the server's url and sha1 through expanding Regex::replace with no validation or JSON escaping #1934
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_string and splice it with regex::NoExpand.
Use parse_vendor_path for the vendored check.
Size
1 file, about ±25 lines, plus 2 tests.
Acceptance criteria
New tests: a url containing $1 and " round-trips to valid JSON with the exact url, and a non-hex sha1 is refused with a warning code.
Still open: the url is written raw, without JSON escaping (hosted.rs:275-276), so a " in it still breaks the lock. The vendored check is still the hand-rolled ".socket/vendor/" prefix test (hosted.rs:233), not parse_vendor_path. No test covers a $1/" url or a non-hex sha1.
[agent] Already fixed on main (checked at e685fb1); closing as completed.
Unescaped url, unchecked sha1. Fixed by Patch Maven reactors and ${property} versions in hosted mode #2114, which added grant::check (crates/socket-patch-core/src/patch/redirect/grant.rs). hosted::engine::build_candidates runs it on every grant before any rewriter sees one. An artifact URL must be a plain http(s) URL of is_url_char characters, which excludes ", \, $, whitespace and control characters, and a served sha1 must be 40 hex digits. A grant that fails is skipped with redirect_grant_malformed and nothing is written. So the url and sha1 this issue's repro used never reach rewrite_composer_lock.
Tests.grant::tests::injected_fields_are_named covers a sha1 holding " and an artifact URL holding ${1} or "; the engine test of build_candidates covers the sha1 case end to end. cargo test -p socket-patch-core --lib -- patch::redirect::grant composer_dist_values: 7 passed.
Not changed: the vendored-entry check in formats/composer/hosted.rs is still the .socket/vendor/ prefix test, not parse_vendor_path. I found no defect in it. The vendored Composer writer only writes .socket/vendor/composer/<uuid>/…, which both rules accept, and the prefix test is the more conservative one for a hand-edited entry (it leaves anything under .socket/vendor/ alone). Reopen if a case turns up where the two disagree in a way that matters.
Activity
mikolalysenko commentedon Nov 1, 2026
[agent] Triage: priority:p2 (Composer). No open PR covers it.
Generated by Claude Code
mikolalysenko commentedon Nov 12, 2026
[agent] Janitor: partly fixed on main (
7208343f), so this stays open.354ab998): the url and sha1 are now spliced through a closure (formats/composer/hosted.rs:268-280), so$1/${name}in either value is no longer expanded.hosted.rs:275-276), so a"in it still breaks the lock. The vendored check is still the hand-rolled".socket/vendor/"prefix test (hosted.rs:233), notparse_vendor_path. No test covers a$1/"url or a non-hex sha1.Generated by Claude Code
mikolalysenko commentedon Nov 25, 2026
[agent] Already fixed on
main(checked ate685fb1); closing as completed.grant::check(crates/socket-patch-core/src/patch/redirect/grant.rs).hosted::engine::build_candidatesruns it on every grant before any rewriter sees one. An artifact URL must be a plainhttp(s)URL ofis_url_charcharacters, which excludes",\,$, whitespace and control characters, and a served sha1 must be 40 hex digits. A grant that fails is skipped withredirect_grant_malformedand nothing is written. So the url and sha1 this issue's repro used never reachrewrite_composer_lock.$nexpansion. Fixed by Fix the defects found by the 5.1.0 full review: do no harm, Bundler hosted mode, VEX, monorepo scans #2052 (the closure splice), covered bycomposer_dist_values_are_never_expanded.grant::tests::injected_fields_are_namedcovers a sha1 holding"and an artifact URL holding${1}or"; the engine test ofbuild_candidatescovers the sha1 case end to end.cargo test -p socket-patch-core --lib -- patch::redirect::grant composer_dist_values: 7 passed.Not changed: the vendored-entry check in
formats/composer/hosted.rsis still the.socket/vendor/prefix test, notparse_vendor_path. I found no defect in it. The vendored Composer writer only writes.socket/vendor/composer/<uuid>/…, which both rules accept, and the prefix test is the more conservative one for a hand-edited entry (it leaves anything under.socket/vendor/alone). Reopen if a case turns up where the two disagree in a way that matters.Generated by Claude Code