lastpass / lastpass-cli

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

Nested sub-folders not working, path is treated as folder name #603

Open thijsvdn opened 3 years ago

thijsvdn commented 3 years ago

When generating a new password nested sub-folders are not created. It seems lpass only treats the last forward slash as a separator between the folder and item name. This causes the creation of a folder containing with the full path (minus the part after the last slash) as its name instead of creating a series of nested sub-folders.

Example, when creating a password with: lpass generate --username="foo" --url="https://foo.bar" --no-symbols "my/nested/subfolder/item_name" 32

Actual behaviour:

lpass ls
my/nested/subfolder
    item_name: [id: xxxxxxxxxxxxxxxxxx]

Expected behaviour:

lpass ls
my
    nested
        subfolder
            item_name: [id: xxxxxxxxxxxxxxxxxx]
nottwo commented 3 years ago

@thijsvdn Have you tried separating your folders with backslashes rather than forwardslashes?

https://github.com/lastpass/lastpass-cli/wiki/Specifying-sub-folders-(or-sub-groups)

thijsvdn commented 3 years ago

Thanks, searched high and low for a solution and despite that I've still managed to miss that article.

I did try generating an item with a name structured using the "top\subfolder with spaces/my site with spaces" method, this resulted in the tool returning a password without adding it to LastPass if I'm not mistaken. In any case it did not have the desired result. Not sure if I tried "op\\subfolder/my-site", I'll give it a go as soon as possible.

thijsvdn commented 3 years ago

Did some further testing, it seems to be related to shared folders. Trying to generate a password in a regular folder test folder\test customers\customer_name/item name works as expected.

Generating a password for Shared-test folder\test customers\customer_name/item_name (or showing an existing item) results in Error: Unable to find shared folder for Shared-test folder\test customers\customer_name/item_name in blob. Double or single backslashes make no difference, in this case the user had administrator permissions.

Mior commented 2 years ago

Having same issue. It is visible only when having more than 1 level sub-folders not on single level, using double backlashes to separate sub-folders works when adding password like "main-folder\sub-folder/password-entry-name", It looks fine from LastPass web Vault but then when trying to access same password from CLI with full path and backslashes to separate folder (basically same way I create them) it failed to unable to retrieve password.

Steps to reproduce:

Mior commented 2 years ago

Possible duplication https://github.com/lastpass/lastpass-cli/issues/266