Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing whitespace removed when copying password to clipboard #2873

Closed
leandrolanzieri opened this issue Apr 26, 2024 · 6 comments
Closed
Milestone

Comments

@leandrolanzieri
Copy link

leandrolanzieri commented Apr 26, 2024

Summary

Hi there. I just found that whenever a secret has a trailing whitespace, copying as gopass show -c test_secret doesn't copy the whitespace. Showing the secret without copying prints the secret correctly. Also, intermediate whitespaces work fine.
Is this known / intentional? Perhaps having a trailing whitespace is not an expected use case.

Steps To Reproduce

Create a new secret with a trailing whitespace (e.g., supersecure ). Try copying with gopass show -c test_secret.

Expected behavior

supersecure ends up on the clipboard.

Environment

  • OS: Manjaro Linux
  • OS version: Linux 5.10.211-1-MANJARO #1 SMP PREEMPT Fri Mar 1 16:55:20 UTC 2024 x86_64 GNU/Linux
  • gopass Version: gopass 1.15.11 go1.21.4 linux amd64
  • Installation method: yay
@dominikschulz
Copy link
Member

Correct. We currently do not support passwords with leading or trailing whitespaces: https://github.com/gopasspw/gopass/blob/master/pkg/gopass/secrets/akv.go#L253

@dominikschulz dominikschulz added this to the 1.x.x milestone Jul 20, 2024
@lhardt
Copy link
Contributor

lhardt commented Sep 30, 2024

Since key-value pairs are only key: value, with a single space (see kvSep), it must be fine to remove TrimSpace and just remove the first character instead. Do you mind if I check in a PR for that?

@dominikschulz
Copy link
Member

@lhardt That does sound like it shouldn't break any existing workflows that we'd want to support. If you do so please only remove the first character if it's a whitespace. I haven't recently looked at the KV implementation, but we might still support key:value (missing whitespace) and shouldn't break that if we currently do.

lhardt added a commit to lhardt/gopass that referenced this issue Oct 1, 2024
Signed-off-by: Leo Hardt <leom.hardt@gmail.com>
@lhardt
Copy link
Contributor

lhardt commented Oct 3, 2024

Done :)

See PR #2954

dominikschulz pushed a commit that referenced this issue Oct 7, 2024
* [ENHANCEMENT] Allow for whitespace-trailing passwords (#2873)

Signed-off-by: Leo Hardt <leom.hardt@gmail.com>

* [ENHANCEMENT] Allow for whitespace-trailing passwords pt2

Signed-off-by: Leo Hardt <leom.hardt@gmail.com>

---------

Signed-off-by: Leo Hardt <leom.hardt@gmail.com>
@dominikschulz
Copy link
Member

Should be fixed by #2954.

@leandrolanzieri
Copy link
Author

Great to see this in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants