This issue has affected several tests as well as a real user (@helderco ). In some cases #SecretExec may fix this with echo -n. In other cases like gitpull.go we had to use strings.TrimSpace before using the secret plain text value. In some cases it seems the presence of trailing space characters (including \n) doesn't matter but on other cases it does.
A quick test of these scenarios proved that adding strings.TrimSpace to plancontext.New() solved the issue across the board.
PROPOSAL
Add a flag to engine._#inputSecret:
plancontext.New() will then user strings.TrimSpace() if trimSpace=true
This solves for all secret types (env var, file, and exec) and gives the user the ability to opt out of trimming for any scenario where a space may actually be included in the secret value.
This issue has affected several tests as well as a real user (@helderco ). In some cases
#SecretExecmay fix this withecho -n. In other cases likegitpull.gowe had to usestrings.TrimSpacebefore using the secret plain text value. In some cases it seems the presence of trailing space characters (including\n) doesn't matter but on other cases it does.A quick test of these scenarios proved that adding
strings.TrimSpacetoplancontext.New()solved the issue across the board.PROPOSAL
Add a flag to
engine._#inputSecret:plancontext.New()will then userstrings.TrimSpace()iftrimSpace=trueThis solves for all secret types (env var, file, and exec) and gives the user the ability to opt out of trimming for any scenario where a space may actually be included in the secret value.