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

Can't create file attachment with CLI from Snap #3923

Open
1 task done
matbgn opened this issue Oct 28, 2022 · 3 comments · May be fixed by #5577
Open
1 task done

Can't create file attachment with CLI from Snap #3923

matbgn opened this issue Oct 28, 2022 · 3 comments · May be fixed by #5577
Labels
bug cli CLI Application

Comments

@matbgn
Copy link

matbgn commented Oct 28, 2022

Steps To Reproduce

  1. login with CLI
  2. touch test.txt in Downloads folder for instance
  3. bw create attachment --file ./test.txt --itemid ea4c89e8-2a8f-4b78-81cb-d4f9699ce12b

Expected Result

{"object":"item","id":"ea4c89e8-2a8f-4b78-81cb-d4f9699ce12b", ....}

Actual Result

mac failed.
? Master password: [hidden]
node:fs:585
handleErrorFromBinding(ctx);
^

Error: EACCES: permission denied, open '/home/matbgn/test.txt'
at Object.openSync (node:fs:585:3)
at Object.openSync (pkg/prelude/bootstrap.js:796:32)
at Object.readFileSync (node:fs:453:35)
at Object.readFileSync (pkg/prelude/bootstrap.js:1082:36)
at CreateCommand. (/snapshot/clients/apps/cli/build/bw.js:34119:55)
at Generator.next ()
at /snapshot/clients/apps/cli/build/bw.js:34022:71
at new Promise ()
at /snapshot/clients/apps/cli/build/bw.js:34018:12
at CreateCommand.createAttachment (/snapshot/clients/apps/cli/build/bw.js:34101:16) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/home/matbgn/test.txt'
}

Screenshots or Videos

No response

Additional Context

I think it is still related to #3596

Operating System

Linux

Operating System Version

Ubuntu 22.04

Shell

Bash

Build Version

2022.10.0

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@matbgn matbgn added bug cli CLI Application labels Oct 28, 2022
@jikamens
Copy link

Also cannot save file attachments:

$ bw get attachment ... --itemid ... 
Cannot save file to /home/jik/Desktop...
$ 

Basically it appears that the snap isn't asking for the necessary permissions to be able to access the filesystem outside the snap.

@zakkolar
Copy link

I think this is related. I'm trying to save backups to a mounted disk. When I run bw export, after providing my password, I get the same error as above:

Cannot save file to [path]

When trying to enable this permission manually via snap connect bw:removable-media, I get:

error: snap "bw" has no plug named "removable-media"

jmlrt added a commit to jmlrt/clients that referenced this issue Jun 7, 2023
This commit is adding back the home interface to the cli snap package. This is needed to allow saving Bitwarden attachments and exports to the disk.

Also, add removable-media permission to allow saving Bitwarden attachments and exports to USB disks and equivalents.

The home interface was previously present but has been removed as part of bitwarden#3596.

This commit should fix bitwarden#3923
@jmlrt jmlrt linked a pull request Jun 7, 2023 that will close this issue
5 tasks
@TroyBW
Copy link

TroyBW commented Aug 4, 2023

Hi there,

Thank you for your report!

I was able to reproduce this issue, and I have flagged this to our engineering team.

If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these.

In the meantime, please consider using the latest CLI client for Linux (other than Snap): https://github.com/bitwarden/clients/releases/download/cli-v2023.7.0/bw-linux-2023.7.0.zip
and call "./bw" to use it instead of the Snap release, and that should allow you to access the file system.

Thanks once again!

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

Successfully merging a pull request may close this issue.

4 participants