WW-5719 Pin Maven distribution checksum - #1942
cameroncrippen wants to merge 2 commits into
Conversation
Launchers generated from Apache Maven Wrapper 3.3.4. Preparation and validation used OpenAI Codex assistance.
lukaszlenart
left a comment
There was a problem hiding this comment.
Thanks for the careful write-up and provenance notes — I re-verified both artifacts independently (SHA-256 recomputed from Maven Central bytes, and PGP signatures check out against the Maven KEYS file), and the launchers are byte-identical to the upstream 3.3.4 script release. All good on that front.
I'd like to take the smaller route to the same goal, though. The only-script mvnw / mvnw.cmd already on main support distributionSha256Sum — the POSIX launcher verifies with sha256sum/shasum before unzipping (current mvnw:226-245), and the Windows launcher does the same with Get-FileHash before Expand-Archive (current mvnw.cmd:138-150). Both fail closed on a mismatch. So pinning the distribution needs only one line in .mvn/wrapper/maven-wrapper.properties:
distributionSha256Sum=5af3b743dd8b876b5c45da33b676251e5f1687712644abb4ee519ca56e1d89ceCompared with switching to the script variant, that keeps:
- one pin to maintain instead of three (
distributionSha256Sum+wrapperUrl+wrapperSha256Sum), and no downloaded wrapper jar to execute before Maven itself runs; - the
java-on-PATHfallback on Windows (thescriptvariant'smvnw.cmdhard-requiresJAVA_HOME); MVNW_REPOURLworking for every download. With thescriptvariant, the explicitwrapperUrlproperty overridesMVNW_REPOURLon POSIX (mvnw:222-233reads the env var first and then the properties value wins), whilemvnw.cmddoes the opposite — so a mirror-only Linux/macOS host can't bootstrap. Reproduced here.
The .tar.gz fallback on hosts without unzip would fail the zip pin, which I'm fine with — that path fails closed with a clear message, unzip is present on every runner we build on, and Windows uses Expand-Archive so it isn't affected.
Could you rework the PR to:
- revert
mvnwandmvnw.cmdto the versions onmain; - keep
distributionType=only-scriptand add only thedistributionSha256Sumline above (dropwrapperUrl/wrapperSha256Sumand the comment line, so the file stays reproducible frommvn wrapper:wrapper).
Happy to merge once that's in.
Apply the maintainer-requested one-line checksum configuration. Preparation and validation used OpenAI Codex assistance.
|
Thanks for the review. I have restored both launchers to Two fresh-cache Windows Java 17 checks passed: the correct checksum starts Maven 3.9.16, and an intentionally incorrect expected checksum rejects the ordinary download before Maven starts. The launcher bytes match the reviewed base exactly. I have retained the documented POSIX limitation for systems without |
Fixes WW-5719.
Add the pinned Maven 3.9.16 ZIP's SHA-256 to the existing
only-scriptwrapper configuration. The current launchers already verify this property before extracting fresh downloads. In response to review, this revision restores both launchers tomainand removes the proposed wrapper-JAR settings. The final diff is one added properties line.Validation on Windows with Java 17: a fresh-cache bootstrap with the correct checksum started Maven 3.9.16 successfully; a separate fresh-cache fixture using the same ordinary download and a deliberately incorrect expected checksum stopped with a checksum error before Maven started. Both launcher files match the reviewed main versions byte for byte. The ZIP's SHA-256 was independently recomputed from the downloaded archive.
Existing cached installations are not revalidated. On POSIX systems without
unzip, the tar.gz fallback will not match the ZIP checksum and will fail closed, as discussed in review. Native Linux/macOS execution and upstream CI for this revision remain unverified. The earlier 4,449-test package result applies to the previous proposal; it was not rerun for this one-line change.AI disclosure: this revision, validation and description were prepared with OpenAI Codex assistance.