Skip to content

[MWRAPPER-117] added distributionSha512Sum and wrapperSha512Sum#398

Open
erik-meuwese-topicus wants to merge 1 commit intoapache:masterfrom
erik-meuwese-topicus:MWRAPPER-117-add-sha512sum
Open

[MWRAPPER-117] added distributionSha512Sum and wrapperSha512Sum#398
erik-meuwese-topicus wants to merge 1 commit intoapache:masterfrom
erik-meuwese-topicus:MWRAPPER-117-add-sha512sum

Conversation

@erik-meuwese-topicus
Copy link

added distributionSha512Sum and wrapperSha512Sum for verification with SHA-512 since Maven only publishes the SHA-512 checksum and not the SHA-256 checksum.

The wrapper SHA-512 is pulished on https://maven.apache.org/tools/wrapper/download.cgi
The distribution SHA-512 is published on https://maven.apache.org/download.cgi

The SHA-256 option is still available for backward compatibility. However this could be marked deprecated and removed in future versions since Maven doesn't publish the SHA-256 checksums.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

…erification with SHA-512 since Maven only publishes the SHA-512 checksum and not the SHA-256 checksum
@yeikel
Copy link

yeikel commented Jan 30, 2026

However this could be marked deprecated and removed in future versions since Maven doesn't publish the SHA-256 checksums

Is this potential deprecation tracked? I ask because it may be lost and I wonder if we can add that as a log as part of this change?

@yeikel
Copy link

yeikel commented Jan 30, 2026

The wrapper SHA-512 is published on https://maven.apache.org/tools/wrapper/download.cgi

This link confused me because that's about the wrapper. I think that you meant to share something like https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.12/ where each distribution after 3.9.0 has a {file}.{sha512} file.

@elharo elharo changed the title MWRAPPER-117 - added distributionSha512Sum and wrapperSha512Sum [MWRAPPER-117] added distributionSha512Sum and wrapperSha512Sum Jan 31, 2026
exit 1
fi
if [ $distributionSha512Result = false ]; then
echo "Error: Failed to validate Maven distribution SHA-512, your Maven distribution might be compromised." >&2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-on sentence

distributionSha512Result=true
fi
else
echo "Checksum validation was requested but neither 'sha512sum' or 'shasum' are available." >&2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or --> nor

fi
else
echo "Checksum validation was requested but neither 'sha512sum' or 'shasum' are available." >&2
echo "Please install either command, or disable validation by removing 'distributionSha512Sum' from your maven-wrapper.properties." >&2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no Please

$distributionSha512Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha512Sum
if ($distributionSha512Sum) {
if ($USE_MVND) {
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha512Sum' from your maven-wrapper.properties."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove nPlease

}
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA512).Hash.ToLower() -ne $distributionSha512Sum) {
Write-Error "Error: Failed to validate Maven distribution SHA-512, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha512Sum property."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-on sentence

@cstamas
Copy link
Member

cstamas commented Feb 4, 2026

Windows seems failing?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants