-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[regression in 1.2 - vs 1.0] com.google.cloud.tools.jib.maven.DecryptedMavenSettings requires all servers to be decryptable #1709
Comments
Thanks for the bug report. I think we should turn this into a warning instead of failing if decryption fails. A missing environment variable like |
@chanseokoh personnally I wouldnt even decrypt servers which are not used to ensure clear values are not even loaded. Do you think it can be an option? |
We also go through all the list of proxies to find active HTTP and HTTPS settings. Not failing on decryption failure will work as if nothing has been done for the failed decryption. It should just work, and I don't see any issue with it. What is your concern? |
Also decryptions appears to be happening wholesale on the file at the moment using the maven api. I'm not sure exactly if it's possible to do this per server. |
@chanseokoh having a build with warning can lead to a fail build on some CI platforms. One option can be to just ignore the failures but at the end there is never the need to decrypt something which is not used - which is safer by construction since we are speaking of passwords. Decryption can be done lazily when the server (same applies to proxy) is fetched injecting the component SettingsDecrypter as done here https://github.com/Talend/component-runtime/blob/87a387eb7796d11cab5ef4159035c54f1bbb3043/talend-component-maven-plugin/src/main/java/org/talend/sdk/component/maven/ImageM2Mojo.java#L195 |
I get what you're saying, but here's my argument.
If
This is a rare situation in that you had |
@chanseokoh I'm not following:
So in all cases a lazy decryption is saner IMO. About the "rare situation", it depends your settings.xml, locally I have ~20 credentials there and per project I tend to use 3-4 only. On the CI all PR builds will have this MISSING_VAR - not FORGOTTEN ;) - setup since part of the variables are only for master build - like documentation redeployment. |
Ah, sorry. I didn't look into the Maven API actually. Seems like you can decrypt per server. |
@rmannibucau, you're right, the API does allow it. We actually changed the code to wholesale decryption based on some weird code paths that we had (sharing gradle/maven code). We'll take another look at this to see if we can solve it more gracefully. |
if it helps: a trivial way to solve it is to copy the settings (really new X().set(original.get()) pattern) and use a DecryptableServer instance extending Server which does the decryption lazily (you pass the decrypter in the constructor). It limits a lot the impacts even if not super elegant. That said happy with any solution on my side :) |
Fixed by #1712. Closing. |
@rmannibucau v1.3.0 is released, and it will not decrypt passwords that are only necessary on demand. |
Description of the issue:
in 1.0 only the used servers by the maven plugin was decrypted.
In 1.2, all are decrypted due to com.google.cloud.tools.jib.maven.DecryptedMavenSettings#from.
Expected behavior:
Get back 1.0 behavior.
Steps to reproduce:
Add a ciphered server not used by jib which can't be deciphered.
TIP: use an invalid password, in my case it was ${env.MISSING_VAR}
Environment:
Linux but probably any.
Log output:
Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.2.0:build (build) on project xxxx: Unable to decrypt settings.xml: [ERROR] Failed to decrypt password for server jetbrains: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: java.io.FileNotFoundException: /home/travis/.m2/settings-security.xml (No such file or directory) @ server: jetbrains -> [Help 1]
(note: intentionally jib does not use settings.xml and it was working great in 1.0 but with 1.2 forced decryption makes the build failing, workaround is to pass decryption data but it is not desired)
The text was updated successfully, but these errors were encountered: