Skip to content

Commit

Permalink
Update the URL pattern regex to correctly mask the SMB2 passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
arunans23 committed Sep 25, 2023
1 parent 96e7ce2 commit 663e5f2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class VFSUtils {
/**
* URL pattern
*/
private static final Pattern URL_PATTERN = Pattern.compile("[a-z]+://.*");
private static final Pattern URL_PATTERN = Pattern.compile("[a-zA-Z0-9]+://.*");

/**
* Password pattern
Expand Down Expand Up @@ -350,7 +350,7 @@ public static String maskURLPassword(String url) {
String maskUrl;
if (urlMatcher.find()) {
final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(url);
maskUrl = pwdMatcher.replaceFirst("\":***@\"");
maskUrl = pwdMatcher.replaceFirst(":***@");
return maskUrl;
}
return url;
Expand Down

0 comments on commit 663e5f2

Please sign in to comment.