Uh oh!
There was an error while loading. Please reload this page.
Fix JsonSyntaxException when creating API command response #4355 - #4387
Conversation
GabrielBrascher
commented
Oct 6, 2020
@blueorangutan package |
blueorangutan
commented
Oct 6, 2020
@GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Oct 7, 2020
Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2140 |
DaanHoogland
commented
Oct 7, 2020
@blueorangutan test |
blueorangutan
commented
Oct 7, 2020
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
blueorangutan
commented
Oct 8, 2020
Trillian test result (tid-2910)
|
didn't work @GabrielBrascher note that in this case the replacement yield a double double quote ( |
GabrielBrascher
commented
Oct 9, 2020
@DaanHoogland what about removing the password from the JSON response? |
DaanHoogland
commented
Oct 14, 2020
@GabrielBrascher If sometimes an extra '"' is added and sometimes not, this is still going to be an issue if you try to remove it. I'd rather replace the exact "something" with "*" or "s". it seems that we are brushing a bug under the carpet otherwise. |
| String[] resp = result.split(pattern); | ||
| String psswd = resp[1].toString().split(",")[0]; | ||
| result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****") + "," + resp[1].split(",", 2)[1]; | ||
| result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****\"") + "," + resp[1].split(",", 2)[1]; |
There was a problem hiding this comment.
Why not complete replace with the ****?
There was a problem hiding this comment.
I am not sure if replacing the password with **** would then affect the intention of the password response.
I think that the idea was to offer admins a hint on the password.
But that is good to keep in mind, thanks for the heads up @rhtyd. What do you think @DaanHoogland?
GabrielBrascher
commented
Oct 14, 2020
@DaanHoogland I proposed removing the password because I don't see much of use in having it on the response, it seems that does not aggregate relevant information. |
DaanHoogland
commented
Oct 14, 2020
It is adding value but only if having a password is optional, @GabrielBrascher. And i think hiding it should be optional as well as a private cloud operator might opt for having it visible. I am not going to argue that anymore, btw. |
GabrielBrascher
commented
Oct 14, 2020
@DaanHoogland fair enough, I am going to re-check these flows to propose a fix keeping the response as it is operating on a consistent password. |
GabrielBrascher
commented
Oct 14, 2020
@DaanHoogland I found out why some cases the regex failed and some not. Updated code to fix it (for good, I hope). Also added test case addressing both situations. The regex uses comma to set the split separator: However, the specific case that I got with OOBM it has the following JSON String: With that said, the code has been updated to deal with both cases: |
GabrielBrascher
commented
Oct 14, 2020
@blueorangutan package |
blueorangutan
commented
Oct 14, 2020
@GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Oct 14, 2020
Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2180 |
DaanHoogland
commented
Oct 15, 2020
@blueorangutan test |
blueorangutan
commented
Oct 15, 2020
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
blueorangutan
commented
Oct 15, 2020
Trillian test result (tid-2969)
|
DaanHoogland
commented
Oct 16, 2020
@rhtyd no further comments? |
Description
Added missing
\"(from"*****"to"*****\"") at obfuscatePassword method from AsyncJobManagerImpl.java#L485cloudstack/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
Line 485 in 0f3f2a0
The lack of
"caused a JsonSyntaxException exception when the host response had a password (e.g. if the host has out of band enabled e.g. IPMI or Redfish).Fixes: #4355
Types of changes
How Has This Been Tested?