Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MWRAPPER-103] Workaround: demote check to Warning #131

Closed
wants to merge 2 commits into from

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Apr 17, 2024

For start, instead to die off, let's demote the failure to warning level.


https://issues.apache.org/jira/browse/MWRAPPER-103

For start, instead to die off, let's demote the failure to
warning level.

---

https://issues.apache.org/jira/browse/MWRAPPER-103
@cstamas
Copy link
Member Author

cstamas commented Apr 17, 2024

@gsmet eyes please. Disclaimer: I am not Win guy, so if you can bring on someone to verify, please do so.

@cstamas
Copy link
Member Author

cstamas commented Apr 17, 2024

@jorsol eyes please

On Windows the error was demoted to Warning.
@jorsol
Copy link
Contributor

jorsol commented Apr 17, 2024

The issue affects the wrapperSha256Sum from mvnw, not only-mvnw, actually the only-mvnw does not validate the wrapperSha256Sum since it doesn't download the jar.

In the end, this is not the fix for the issue reported, the trouble is that only-mvnw does different things than mvnw, so it seems that using only-mvnw works and mvnw don't.

@cstamas
Copy link
Member Author

cstamas commented Apr 17, 2024

Oh, got it now. Ok, am closing this one out then, as I missed the topic.

@cstamas cstamas closed this Apr 17, 2024
@cstamas cstamas deleted the MWRAPPER-103 branch April 17, 2024 12:14
@jorsol
Copy link
Contributor

jorsol commented Apr 17, 2024

Since the default is now only-mvnw, maybe the current workaround is to simply remove the lines from:

@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)

Or comment the if ERRORLEVEL 1 goto error (not sure if this is enough).

@cstamas
Copy link
Member Author

cstamas commented Apr 17, 2024

Yup, that is my problem as well: "not sure" 😄

@cstamas
Copy link
Member Author

cstamas commented Apr 17, 2024

Next attempt: #132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants