special character in secret text

classic Classic list List threaded Threaded
1 message Options
HB
Reply | Threaded
Open this post in threaded view
|

special character in secret text

HB
Hi,

I am attempting to mask passwords in config files by creating secret text credentials and using them to search and replace the values in the files.  It is working as expected except for when there is a dollar sign '$' special character in the secret text.  With the '$' in the secret text, it gets expanded into a 5 digit number upon running the sed line in the 'execute shell script on remote host using ssh'.  What's odd is it's a different 5 digit number each run.  Here is the sed line from the block in Jenkins:

sed -i "s/#{PASSWORD_IN_CONFIG}#/${config_password}/gI" config.file

If the password in the secret text is say: pas$word

In 3 concurrent runs the output in the config.file is:

pas123749word
pas124079word
pas124277word

If I try to escape the dollar sign in the secret text as: pas\$word

The output is:

pas$

As mentioned, it works fine with standard characters in the secret text.  I'm not sure if the issue is on the secret text side, in the sed command, or at the bash level.

Can anyone provide guidance as to what is going on?

Thanks,

HB 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/afb00b0c-0d99-424a-834f-049f024dbfea%40googlegroups.com.