lastpass / lastpass-cli

LastPass command line interface tool
GNU General Public License v2.0
2.85k stars 292 forks source link

lpass add doesn't provide a reliable way to retrieve the added entry. #539

Open bsutton opened 4 years ago

bsutton commented 4 years ago

The lpass add command allows you to add a key even if it already exists.

Additionally lpass add does not return the uniqueid of the newly added key.

The problem with this is that it is impossible to guarantee that you can get back the original entry that you added.

Whilst you might think you could first check if the entry exists before adding the new value this may not work in practice. If you do a check and then another process runs which adds its own key (or performs a sync which downloads a key) you may end up with an identical key being inserted after you check the local store.

We need a switch on the lpass add command to return the uniqueid of the newly added entry.

There is a hacky way around this, which is to add a field with a guid and then retrieve all entries looking for the one with the matching guid, but this shouldn't be necessary.