[ 
https://issues.apache.org/jira/browse/SCM-763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17962902#comment-17962902
 ] 

ASF GitHub Bot commented on SCM-763:
------------------------------------

jira-importer commented on issue #970:
URL: https://github.com/apache/maven-scm/issues/970#issuecomment-2964636671

   **[Michael 
Osipov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=michael-o)**
 commented
   
   [Weston 
Bustraan](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=wbustraan),
 your improved version does not work:
   
   ```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());
   
   }
   ```
   
   ```
   cmd.exe /X /C "svn --password mumu"
   cmd.exe /X /C "svn --password '******'
   ```
   
   It also changes the quoting style on Windows if the password contains a 
space.
   




> Password masking for svnexe does not handle all cases
> -----------------------------------------------------
>
>                 Key: SCM-763
>                 URL: https://issues.apache.org/jira/browse/SCM-763
>             Project: Maven SCM (Moved to GitHub Issues)
>          Issue Type: Bug
>          Components: maven-scm-provider-svn
>    Affects Versions: 1.9
>         Environment: Jenkins 1.502 on a SLES11
>            Reporter: Tobias Kalmes
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 1.10.0
>
>
> 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
(v8.20.10#820010)

Reply via email to