-
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
Maven Encryption does not work #592
Comments
HI @eddiewebb thanks for reporting this issue! We will investigate this as a high priority issue. @GoogleContainerTools/java-tools |
@briandealwis - for what its worth I believe the maven 3.0+ way to decrypt is with https://maven.apache.org/ref/3.2.5/maven-settings-builder/apidocs/org/apache/maven/settings/crypto/SettingsDecrypter.html, I was working on a PR but am not your preference on injecting the component from plexus container. Nullaway yelled at me for trying a simple i.e. in MavenSettingsServerCredentials /**
* Attempts to retrieve credentials for {@code registry} from Maven settings.
*
* @param registry the registry
* @return the credentials for the registry
*/
@Nullable
RegistryCredentials retrieve(@Nullable String registry) {
if (registry == null) {
return null;
}
Server registryServerSettings = decrypt(settings.getServer(registry));
if (registryServerSettings == null) {
return null;
}
return new RegistryCredentials(
CREDENTIAL_SOURCE,
Authorizations.withBasicCredentials(
registryServerSettings.getUsername(), registryServerSettings.getPassword()));
}
@Nullable
private Server decrypt(Server server) {
if (server == null) {
return null;
}
SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server);
SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt(decryptionRequest);
return decryptionResult.getServer();
} |
@coollog just to get a quick answer for my convenience, we documented that Maven password encryption will work (https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#using-maven-settings), but in reality, we never implemented the logic to decrypt it? |
That's right @chanseokoh. I have it working, just trying to figure out how to best communicate back decryption problems. And thanks @eddiewebb; I came across some examples too. Using |
Hi @eddiewebb , we just released versoin |
Confirmed! thanks @coollog ! |
Great! Thanks to @briandealwis for the fix |
Description of the issue:
When credentials in settings.xml are encrypted, jib throws a 401 error, but other tools (including https://github.com/jelmerk/maven-settings-decoder) show the proper password.
If I leave password in plaintext in settings.xml it works.
Expected behavior:
Credentials should be decrypted, I expect they are being passed as is.
Steps to reproduce:
Environment:
jib-maven-plugin
Configuration:~/.m2/settings.xml
~/.m2/settings-security.xml
Log output:
Additional Information:
To debug I first ran maven with -X, and it confirms the existence of
env.maven_security_master={output from --encrypt-master-password}
I then used https://github.com/jelmerk/maven-settings-decoder to decrypt maven credentials.
There are no special characters in my password (letters and numbers) and no special characters in the generated values (I also tried several iterations)
I have seen the mvn release plugin require certain version, so perhaps some dependency of jib is not where it needs to be?
The text was updated successfully, but these errors were encountered: