Search code examples
anttee

Ant SecureInputHandler: prints password in clear text when used with tee


We use Ant's secure handler to enter passwords:

<input message="Please enter TFS password: " addproperty="tfs.password">
  <handler type="secure"/> 
</input>

That, of course, does work: input is not printed.

When though (to save the build log) we run the build as

ant | tee build.log

the input is printed in clear text. Oops.

I wonder where is the issue (ant? tee?) and how to fix that.

P.S. OS:

Linux devosb1 3.0.0-12-generic #20-Ubuntu 
SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

P.P.S. OK, so it is not tee -- a shell script with read/echo instead of tee triggers the same behaviour.


Solution

  • Looks like a shell issue. Have you considered using the ANT record task?

    <project name="demo" default="build">
    
        <target name="build">
            <record name="build.log" loglevel="verbose"/>
    
            <input message="Please enter TFS password: " addproperty="tfs.password">
                <handler type="secure"/> 
            </input>
        </target>
    
    </project>