realestate-com-au / shush

It's a secret.
169 stars 36 forks source link

Chomp the input, and warn if something was chomped #7

Closed tigris closed 6 years ago

tigris commented 7 years ago

It is quite common to pipe a string to shush encrypt via echo and forget the -n. It'd be nice to DWIM in this scenario, perhaps with a warning.

I understand this changes behaviour and it would now be impossible to encrypt a string with a newline on the end. We could cross that bridge when it comes, or add in a flag, or not chomp but just print the warning, or document it and you could put 2 newlines to get 1 newline in there 😄

mdub commented 7 years ago

I really don't like the idea of changing the existing behaviour. IMHO shush should be completely agnostic about the string you're encrypting. shush encrypt ... | shush decrypt should be a no-op.

It's pretty common to use shush to encrypt strings containing newlines, e.g. SSH keys, TLS certs.

tigris commented 7 years ago

By chomp I only meant to warn / remove for a trailing newline, not ones buried inside the string. I agree it should be a no-op, I wonder if a simple warn about a trailing newline might be worthwhile? While still encrypting with it in there.

mdub commented 7 years ago

Re-reading ... I'm happy with a (suppressible) warning on encrypt.

I think I thought you were suggesting a warning on decrypt, which would be less good.

ghost commented 6 years ago

I'm closing this issue because it's gone stale.