[
https://issues.apache.org/jira/browse/SCM-763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403773#comment-16403773
]
Michael Osipov edited comment on SCM-763 at 3/17/18 10:34 PM:
--------------------------------------------------------------
[~wbustraan], your improved version does not work:
{code:java}
public static void main(String[] args) {
Commandline cl = new Commandline(new CmdShell());
cl.setExecutable("svn");
cl.createArg().setValue("--password");
cl.createArg().setValue("mumu");
System.out.println(cl);
String clString = cl.toString();
final String mask = "'******'";
final Matcher matcher =
Pattern.compile("(--password\\S*?\\s+)('[^']+?'|\"[^\"]+?\"|\\S+)")
.matcher(clString);
final StringBuffer replaced = new StringBuffer();
while (matcher.find()) {
final String argPrefix = matcher.group(1);
matcher.appendReplacement(replaced, argPrefix + mask);
}
matcher.appendTail(replaced);
System.out.println(replaced.toString());
}
{code}
{noformat}
cmd.exe /X /C "svn --password mumu"
cmd.exe /X /C "svn --password '******'
{noformat}
It also changes the quoting style on Windows if the password contains a space.
was (Author: michael-o):
[~wbustraan], your improved version does not work:
{code:java}
public static void main(String[] args) {
Commandline cl = new Commandline(new CmdShell());
cl.setExecutable("svn");
cl.createArg().setValue("--password");
cl.createArg().setValue("mumu");
System.out.println(cl);
String clString = cl.toString();
final String mask = "'******'";
final Matcher matcher =
Pattern.compile("(--password\\S*?\\s+)('[^']+?'|\"[^\"]+?\"|\\S+)")
.matcher(clString);
final StringBuffer replaced = new StringBuffer();
while (matcher.find()) {
final String argPrefix = matcher.group(1);
matcher.appendReplacement(replaced, argPrefix + mask);
}
matcher.appendTail(replaced);
System.out.println(replaced.toString());
}
{code}
{noformat}
cmd.exe /X /C "svn --password mumu"
cmd.exe /X /C "svn --password '******'
{noformat}
> Password masking on linux does not work
> ---------------------------------------
>
> Key: SCM-763
> URL: https://issues.apache.org/jira/browse/SCM-763
> Project: Maven SCM
> Issue Type: Bug
> Components: maven-scm-provider-svn
> Affects Versions: 1.9
> Environment: Jenkins 1.502 on a SLES11
> Reporter: Tobias Kalmes
> Priority: Major
>
> Passwords are not masked in the log output on Linux machines. The masking
> works as intended on Windows machines. On linux machines tho the password is
> printed in clear text. This seems to be a problem due to the additional
> single quotes that are added around the parameters on linux machines.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)