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 Maven splices the API's suffixed version into pom.xml unchecked, while hosted Gradle refuses the same grant #882
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: discussion #560 register.
Kind: bug. Source: new finding (register E63); related to review Part 5.4 (JVM) and E40.
Problem
Both hosted JVM planners take the pinned version from the same API field, RegistryOverrideIdentifiers::maven_suffixed_version, but only the Gradle one checks it. Verified on 9c43dfc:
Hosted Gradle puts the grant in a HostedRow and refuses it with redirect_gradle_override_invalid unless HostedRow::valid holds. That check requires safe coordinates, a canonical lowercase uuid, suffixed == <base>-socket.<uuid[..8]>, an https URL and two lowercase sha256s (plan_dep).``
Hosted Maven (rewrite_maven_pom) clones the string and splices it verbatim into every matching <version>. The same string also goes into the .mvn/checksums path. There is no grammar check and no XML escaping. Its unit fixture already pins a suffix that Gradle would refuse: patch_uuid: "uuid" with 1.7.36-socket.aaaaaaaa.
The <base>-socket.<hex8> grammar now has four builders and no shared validator:
the server's mavenSuffixedVersion, which hosted Maven trusts as is.
The group/artifact derivation is also written twice: inline in rewrite_maven_pom and as gradle::coords_of.``
Proof by execution (a throwaway unit test, run twice on 9c43dfc). One DepOverride per suffix, with a canonical uuid 4d5e6f70-…, was run through rewrite_registry_redirect once against a Gradle build and once against a one-dependency pom.xml:
In a mixed Maven + Gradle repository, the same grant is refused for one build and silently pinned for the other.
If the pinned suffix is not <base>-socket.<hex8 of uuid>, VEX's consumed-copy lookup (which rebuilds the suffix from the uuid) and vendored mode look for a different version directory than the one hosted Maven pinned. I read this path but did not execute it.
The patch server is trusted, so this is defense in depth and drift, not an exploit. But the Maven writer is the only hosted writer that splices server text into markup without validating it. Size: small, about 1 function plus a shared helper.
Proposed change
Add one JVM grant reader beside formats::maven::split_socket_version. It provides suffixed_version(base, uuid), is_suffix_of(base, uuid, s) and maven_grant(dep) -> Result<MavenGrant, Refusal>, which covers coordinates, suffix, uuid and sha256s.
HostedRow::valid and rewrite_maven_pom both use it. Hosted Maven refuses an invalid grant with a warning code, as Gradle does, instead of pinning it.
Delete redirect::gradle::suffixed_version, coords_of and the inline coordinate derivation in rewrite_maven_pom. Have jvm::Coords::suffixed_version delegate to the shared builder.
Files: formats/maven/mod.rs, patch/redirect/mod.rs (the Maven arm only), patch/redirect/gradle.rs, vendor/jvm/mod.rs, and CLI_CONTRACT.md (one new warning code).
About 80–150 production lines changed, net negative.
Hosted Maven refuses a grant whose suffix isn't <base>-socket.<uuid[..8]>, whose uuid isn't canonical, or whose coordinates aren't safe, and writes nothing for that dep.
Regression test: the five suffixes above give the same accept/refuse verdict for Maven and Gradle.
The Maven unit fixtures use a canonical uuid and a matching suffix.
One suffix builder remains in core. jvm::Coords, hosted Gradle and the new validator share it.
cargo test -p socket-patch-core --lib redirect, plus the hosted Maven and Gradle e2e suites, stay green.
Dependencies
None. This unblocks the Maven child of #855 (one builder to call) and makes #717's pom-locating work independent of grant validation.
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: discussion #560 register.
Kind: bug. Source: new finding (register E63); related to review Part 5.4 (JVM) and E40.
Problem
Both hosted JVM planners take the pinned version from the same API field,
RegistryOverrideIdentifiers::maven_suffixed_version, but only the Gradle one checks it. Verified on9c43dfc:HostedRowand refuses it withredirect_gradle_override_invalidunlessHostedRow::validholds. That check requires safe coordinates, a canonical lowercase uuid,suffixed == <base>-socket.<uuid[..8]>, an https URL and two lowercase sha256s (plan_dep).``rewrite_maven_pom) clones the string and splices it verbatim into every matching<version>. The same string also goes into the.mvn/checksumspath. There is no grammar check and no XML escaping. Its unit fixture already pins a suffix that Gradle would refuse:patch_uuid: "uuid"with1.7.36-socket.aaaaaaaa.The
<base>-socket.<hex8>grammar now has four builders and no shared validator:jvm::Coords::suffixed_version(vendored; strips dashes, lowercases);redirect::gradle::suffixed_version(uuid.get(..8));vex_consumed.rs(Tracking: move vex_consumed's per-ecosystem consumed-copy rules from the CLI into core #855);mavenSuffixedVersion, which hosted Maven trusts as is.The group/artifact derivation is also written twice: inline in
rewrite_maven_pomand asgradle::coords_of.``Proof by execution (a throwaway unit test, run twice on
9c43dfc). OneDepOverrideper suffix, with a canonical uuid4d5e6f70-…, was run throughrewrite_registry_redirectonce against a Gradle build and once against a one-dependencypom.xml:maven_suffixed_version1.10.0-socket.4d5e6f701.10.0-socket.DEADBEEFredirect_gradle_override_invalid1.10.0-socket.4D5E6F701.10.0-patched1.10.0</version><scope>system</scope><version>1.10.0pom.xmlas markup, no warningSymptoms and impact
<base>-socket.<hex8 of uuid>, VEX's consumed-copy lookup (which rebuilds the suffix from the uuid) and vendored mode look for a different version directory than the one hosted Maven pinned. I read this path but did not execute it.Proposed change
formats::maven::split_socket_version. It providessuffixed_version(base, uuid),is_suffix_of(base, uuid, s)andmaven_grant(dep) -> Result<MavenGrant, Refusal>, which covers coordinates, suffix, uuid and sha256s.HostedRow::validandrewrite_maven_pomboth use it. Hosted Maven refuses an invalid grant with a warning code, as Gradle does, instead of pinning it.redirect::gradle::suffixed_version,coords_ofand the inline coordinate derivation inrewrite_maven_pom. Havejvm::Coords::suffixed_versiondelegate to the shared builder.vex_consumedcopy, which is child 3 of Tracking: move vex_consumed's per-ecosystem consumed-copy rules from the CLI into core #855 and should call the same builder once it lands.Size and scope
formats/maven/mod.rs,patch/redirect/mod.rs(the Maven arm only),patch/redirect/gradle.rs,vendor/jvm/mod.rs, andCLI_CONTRACT.md(one new warning code).Acceptance criteria
<base>-socket.<uuid[..8]>, whose uuid isn't canonical, or whose coordinates aren't safe, and writes nothing for that dep.jvm::Coords, hosted Gradle and the new validator share it.cargo test -p socket-patch-core --lib redirect, plus the hosted Maven and Gradle e2e suites, stay green.Dependencies
None. This unblocks the Maven child of #855 (one builder to call) and makes #717's pom-locating work independent of grant validation.