0

I do quite agree with those two philosophies concerning whitespaces in passwords: they should be possible and responsibility left to user.

However linux native Password Store utility, wrapping around gpg, does trim leading and trailing whitespaces:

$ pass insert test
Enter password for test:   wrapped   <Enter>
Retype password for test:   wrapped   <Enter>
$ pass test
wrapped|--------> well.. naked.

Is this just a customizable default behaviour?
How can I fix this?

iago-lito
  • 3,098
  • 3
  • 29
  • 54

1 Answers1

3

The problem is that the script obtains the passwords by running the read builtin. By default, this builtin scrubs leading and trailing whitespace.

This can be fixed by clearing the IFS environment variable, prior to using read.

As such, you will have to manually edit the shell script to clear IFS (you will also need to quote $password on line 447, too) if you want this to work.

Phylogenesis
  • 7,775
  • 19
  • 27
  • Neat analyze. Thanks :) If you were me, would you rather create a custom patch or file this as a bug to [`pass`](https://www.passwordstore.org/)? Maybe modifying source this way can have unexpected repercussions.. – iago-lito Nov 07 '17 at 09:53
  • 1
    Why not both? Fix it in your local copy then send a push request to the project with the changes you've made. – Phylogenesis Nov 07 '17 at 09:57
  • Neat. I will :) – iago-lito Nov 07 '17 at 09:58
  • Well, my e-mails to [`pass`](https://lists.zx2c4.com/mailman/listinfo/password-store) seem completely ignored, even though their mailing list seems active.. maybe I've missed something :( – iago-lito Jan 15 '18 at 20:23