Skip to content

Read gradle-wrapper.properties through one parser: the hosted and vendored Gradle 6.8 gates read the wrapper version two different ways and disagree on distributionUrl = … #1963

Not planned

Description

[agent] Filed by the scheduled architecture audit (audit-core). Register: #1830 register.

Kind: bug. Register ID: A72.

Problem

gradle/wrapper/gradle-wrapper.properties is read by three different readers, and they disagree on which Gradle version a build pins:

  1. crawlers::gradle_cache::parse_properties + WrapperProps::of:``` a real java.util.Properties reader (`=`/`:`/whitespace separators, escapes, continuation lines, a later key wins). Used only for init-script discovery.
  2. gradle::graph::wrapper_version: takes the first line that starts with distributionUrl (so distributionUrlBackup=… matches too) and joins no continuation lines. It drives the hosted "Gradle 6.8 or newer" refusal (redirect/gradle.rs L697-L705).````
  3. vendor::jvm::wrapper_version: needs the exact prefix distributionUrl= (no spaces around =, no :, no BOM). It drives the vendored "Gradle 6.8 or newer" refusal (vendor/jvm/gradle.rs L261-L266) and the Maven-wrapper warnings (maven_reactor.rs L154-L160).`````

A fourth spot derives the distribution name from the URL again: GradleHome::wrapper_init_dirs beside WrapperProps::name.``````

Executed (the three functions copied verbatim from main @ cbbbdb9 into a scratch crate):

gradle-wrapper.properties graph (hosted gate) vendor::jvm (vendored gate) parse_properties (what Gradle reads)
distributionUrl = https\\://…/gradle-6.7-bin.zip (6, 7, 0): refused None: not refused gradle-6.7
BOM + distributionUrl=…/gradle-6.7-bin.zip (6, 7, 0): refused None: not refused gradle-6.7
distributionUrlBackup=…/gradle-6.9.4… then distributionUrl=…/gradle-8.14.3… (6, 9, 4) (8, 14, 3) gradle-8.14.3
two distributionUrl lines, 6.9.4 then 8.14.3 (6, 9, 4) (6, 9, 4) gradle-8.14.3 (last wins)
distributionUrl=…/distributions/\\ + continuation gradle-8.14.3-bin.zip None None gradle-8.14.3

So a Gradle 6.7 build written with distributionUrl = … (or saved with a BOM) is refused in hosted mode and vendored anyway. The two hosted/vendored gates also feed the major that selects Gradle 6 vs 7+ range semantics.

Proposed change

  • Move parse_properties and WrapperProps out of crawlers::gradle_cache into a pure gradle::wrapper module over TextReadFn (the gradle module already forbids std::fs; WrapperProps::of keeps a thin disk adapter in the crawler).
  • Add WrapperProps::version() -> Option<(u32, u32, u32)> and delete graph::wrapper_version.
  • Make vendor::jvm::wrapper_version read through the same properties parser for both tools (.mvn/wrapper/maven-wrapper.properties is a .properties file too), or delete it in favour of the shared one.
  • home::wrapper_init_dirs takes the distribution name from WrapperProps::name instead of re-deriving it.

Size

4–5 files (gradle/{mod,graph,home}.rs, new gradle/wrapper.rs, crawlers/gradle_cache.rs, vendor/jvm/mod.rs); about −60/+40 lines.

Acceptance criteria

  • One properties reader for wrapper files; grep -rn 'strip_prefix("distributionUrl' crates finds nothing.
  • New unit cases for the five rows above, asserting the same version from the hosted and the vendored gate.
  • graph::tests::android_kmp_and_wrapper_version and gradle_cache's parse_properties_* tests keep passing (moved with the code).

Generated by Claude Code

Activity

  1. added
    bug
    arch-audit
    on Nov 2, 2026
  2. mikolalysenko commented on Nov 2, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Triage: priority:p3 (Gradle/Maven wrapper parsing, cross-cutting refactor). No duplicate or open PR found.


    Generated by Claude Code

  3. mikolalysenko commented on Nov 25, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] The architecture refactor routine checked this on main at 0a391c1: the defect is gone, so I am closing it as not planned.

    The two "Gradle 6.8 or newer" gates no longer read the wrapper two ways. Since #2052, gradle::graph::wrapper_version (hosted) and vendor::jvm::wrapper_version (vendored) both call [wrapper_distribution_version](https://github.com/SocketDev/socket-patch/blob/0a391c102305e45dab5257fea120e123cb20c662/crates/socket-patch-core/src/crawlers/gradle_cache.rs#L743-L765), which reads the file through parse_properties. That covers the five rows of the table above: distributionUrl = …, a BOM, a longer key that starts with distributionUrl, a repeated key (the last wins) and a continuation line.

    What I ran:

    $ cargo test -p socket-patch-core --lib -- wrapper_version android_kmp_and_wrapper_version
    test gradle::graph::tests::android_kmp_and_wrapper_version ... ok
    test vendor::jvm::tests::wrapper_version_reads_every_properties_spelling ... ok
    test result: ok. 2 passed; 0 failed
    

    wrapper_version_reads_every_properties_spelling asserts (6, 7, 0) from the vendored gate for distributionUrl=, distributionUrl = and distributionUrl:.

    One hand reader of the key is left, [formats::maven::declared_maven::wrapper_maven_version](https://github.com/SocketDev/socket-patch/blob/0a391c102305e45dab5257fea120e123cb20c662/crates/socket-patch-core/src/formats/maven/declared_maven.rs#L63-L88). It reads the Maven wrapper for the declared Maven release, not for either Gradle gate, and I found no input on which it gives a wrong answer for a file the Maven wrapper writes. If someone has one, a new issue with that input is the way to track it.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditbugpriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions