This repository was archived by the owner on Jan 15, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
utils/src/com/cloud/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,9 +159,7 @@ public static String getMaskedPasswordForDisplay(String password) {
159159 }
160160
161161 // removes a password request param and it's value, also considering password is in query parameter value which has been url encoded
162- private static final Pattern REGEX_PASSWORD_QUERYSTRING = Pattern .compile ("(&|%26)?[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*?(?=(%26|[&'\" ]))" );
163-
164- private static final Pattern REGEX_END_PASSWORD_QUERYSTRING = Pattern .compile ("(&|%26)[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*" );
162+ private static final Pattern REGEX_PASSWORD_QUERYSTRING = Pattern .compile ("(&|%26)?[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*?(?=(%26|[&'\" ]|$))" );
165163
166164 // removes a password/accesskey/ property from a response json object
167165 private static final Pattern REGEX_PASSWORD_JSON = Pattern .compile ("\" ((p|P)assword|accesskey|secretkey)\" :\\ s?\" .*?\" ,?" );
@@ -177,7 +175,6 @@ public static String cleanString(String stringToClean) {
177175 String cleanResult = "" ;
178176 if (stringToClean != null ) {
179177 cleanResult = REGEX_PASSWORD_QUERYSTRING .matcher (stringToClean ).replaceAll ("" );
180- cleanResult = REGEX_END_PASSWORD_QUERYSTRING .matcher (cleanResult ).replaceAll ("" );
181178 cleanResult = REGEX_PASSWORD_JSON .matcher (cleanResult ).replaceAll ("" );
182179 Matcher detailsMatcher = REGEX_PASSWORD_DETAILS .matcher (cleanResult );
183180 while (detailsMatcher .find ()) {
You can’t perform that action at this time.
0 commit comments