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

SVT: Improve error message when password cannot be decrypted #29616

Open
mtamboli opened this issue Sep 11, 2024 · 3 comments
Open

SVT: Improve error message when password cannot be decrypted #29616

mtamboli opened this issue Sep 11, 2024 · 3 comments
Assignees
Labels
Acknowledged An initial response has been provided. Remove the 'Needs member attention' label. release bug This bug is present in a released version of Open Liberty serviceability Label used to track serviceability related issues team:Core Security

Comments

@mtamboli
Copy link

mtamboli commented Sep 11, 2024

Describe the bug
A clear and concise description of what the bug is.
I am testing custom AES key as the feature is added to WebSphere/Open Liberty Operator.

I tried incorrect AES password which is not encrypted with provided AES key and I see below exceptions during startup and when accessing DB2. I think these exceptions are not clear and need to be updated. We need to clearly mentioned that password could not decrypted: AES algorithm is known to Liberty.

If there is a stack trace, please include the FULL stack trace (without any [internal classes] lines in it). To find the full stack trace, you may need to check in $WLP_OUTPUT_DIR/messages.log

[9/9/24, 20:55:20:285 UTC] 0000001e com.ibm.websphere.crypto.PasswordUtil                        E CWWKS1856E: The password was not processed because an unknown password algorithm exception was reported.
com.ibm.websphere.crypto.UnsupportedCryptoAlgorithmException
	at com.ibm.ws.crypto.util.PasswordCipherUtil.aesDecipher(PasswordCipherUtil.java:269)
	at com.ibm.ws.crypto.util.PasswordCipherUtil.decipher(PasswordCipherUtil.java:202)
	at com.ibm.websphere.crypto.PasswordUtil.decode_password(PasswordUtil.java:631)
	at com.ibm.websphere.crypto.PasswordUtil.passwordDecode(PasswordUtil.java:437)
	at com.ibm.ws.security.auth.data.internal.AuthDataImpl.activate(AuthDataImpl.java:49)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:245)
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41)
	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:687)
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:531)
	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317)
	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307)

Steps to Reproduce

Steps to reproduce the bug
I saw the problem for Liberty application deployed in OCP cluster but it is equivalent to below steps:

  1. Setup Liberty server
  2. Include custom encryption key in server.xml
    image
  3. Encrypt DB2 password as part of the auth alias (in server.xml) with a different key than above provided key
./securityUtility encode --encoding=aes --key=random db2passwd
{aes}AAGhuS5d7ECi6wS3TpfZPwlWST1Y7w/lXdfLJzS1N29r
  1. When I restart Liberty server, I see exception during startup:
    [9/9/24, 20:55:20:285 UTC] 0000001e com.ibm.websphere.crypto.PasswordUtil E CWWKS1856E: The password was not processed because an unknown password algorithm exception was reported.

Expected behavior
A clear and concise description of what you expected to happen.
We need improved exception which says that provided password cannot be decrypted instead of unknown password algorithm

Diagnostic information:

  • OpenLiberty Version: [e.g. 21.0.0.8 - 21.0.0.10]
  • Affected feature(s) [e.g. mpHealth-3.0]
  • Java Version: [i.e. full output of java -version]
  • server.xml configuration (WITHOUT sensitive information like passwords)
  • If it would be useful, upload the messages.log file found in $WLP_OUTPUT_DIR/messages.log

Liberty version 24.0.0.8
Eclipse OpenJ9 VM, version 17.0.8.1+1 (en_US)

Additional context
Add any other context about the problem here.

@mtamboli mtamboli added release bug This bug is present in a released version of Open Liberty team:Core Security serviceability Label used to track serviceability related issues labels Sep 11, 2024
@mtamboli
Copy link
Author

FYI, @arkarkala @leochr @jgawor

@Zech-Hein
Copy link
Contributor

Hi Monica,

I agree, we can improve the message here
The password was not processed because an unknown password algorithm exception was reported. UnsupportedCryptoAlgorithmException... is not very helpful.

Perhaps we could say something like
Unable to decode the {AES} password, this may be due to the password being encoded using a different encryption key or there is a typo in the encoded password value. Ensure the wlp.password.encryption.key property is set to the same value that was used to encode the password

@mtamboli
Copy link
Author

Hi Monica,

I agree, we can improve the message here The password was not processed because an unknown password algorithm exception was reported. UnsupportedCryptoAlgorithmException... is not very helpful.

Perhaps we could say something like Unable to decode the {AES} password, this may be due to the password being encoded using a different encryption key or there is a typo in the encoded password value. Ensure the wlp.password.encryption.key property is set to the same value that was used to encode the password

I like your suggestion for the new message. Thank you for looking into this.

@Zech-Hein Zech-Hein added the Acknowledged An initial response has been provided. Remove the 'Needs member attention' label. label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged An initial response has been provided. Remove the 'Needs member attention' label. release bug This bug is present in a released version of Open Liberty serviceability Label used to track serviceability related issues team:Core Security
Projects
None yet
Development

No branches or pull requests

2 participants