neosmart / SecureStore

A .NET implementation of the cross-platform SecureStore (symmetrically-encrypted secrets) protocol
MIT License
96 stars 15 forks source link

Unable to set secret with '=' sign #18

Closed ae-vivanov closed 8 months ago

ae-vivanov commented 8 months ago

Hey guys,

I'm trying to store base64 encoded secret that contains = sign, but command line tool doesn't let me do it. I found the line that causes the problem, would like to get some comments why need to check secret value for = sign https://github.com/neosmart/SecureStore/blob/master/Client/Program.cs#L353 ?

SecureStore set "my-secret" "dGVzdA=="

Alternative syntax works as a workaround (even if the secrets start with with = sign):

SecureStore set "my-secret=dGVzdA=="
mqudsi commented 8 months ago

Hi thanks for reporting this bug. I'm glad you discovered the alternative syntax, but we should fix the problem for sure.

I think that line was there as a sanity check to make sure it's not just random command line input being parsed as a key-value pair, but even then, I think the check should read && !bareArguments[0].Contains('=') (name does not contain =).

mqudsi commented 8 months ago

Ok, I fixed it in 8d6cf88 and it'll be in the next release. Since right now there are workarounds, I don't think it's immediately necessary to do a nuget release?

fyi there is yet another syntax you can use that will accept basically any input, you can use ssclient set key <ENTER> then interactively enter the value to be saved.

ae-vivanov commented 8 months ago

Thank you so much!