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

Stop importing vault items associated with an organization #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nkm8
Copy link

@nkm8 nkm8 commented Aug 16, 2021

I don't have time to test this right now, but I wanted to throw it up as a possible suggestion. Currently, portwarden imports all vault items, including items associated with an organization. During the import, the organization(s) and collection(s) are erased and the item is imported as an orphaned item associated with the personal vault.

However, Bitwarden allows exporting all items associated with a given organization. I followed the following procedure:

  1. Export from Bitwarden personal vault via portwarden
  2. Export from Bitwarden organization vault via unencrypted JSON
  3. Import into vaultwarden personal vault via portwarden
  4. Import into vaultwarden organization vault via unencrypted JSON

This worked very well, but I ended up with duplicate entries because the organization vault items were imported by portwarden as ophaned entries. This PR should allow the process above to work, minus the duplicate orphaned entries.

In a perfect world, portwarden would handle creating the organization(s) and collection(s) - same as folders are already handled - but it looks like these commands aren't available in the Bitwarden CLI.

If given a build, I can test this PR. If it works as expected, I can update the Readme file with details about how Organizations/Collections can be handled with existing Bitwarden export/import tools.

@nkm8
Copy link
Author

nkm8 commented Aug 17, 2021

First try working with go, but I was able to build and test this locally: go build .\\cmd\\portwarden\\portwarden.go

I confirmed it worked as expected. Obviously, the 2 caveats are:

  1. You must be the owner of the organization to export the BW JSON
  2. Attachments on organization items are not included

This worked for my needs - feel free to discard or possibly hide behind a feature flag if others find it useful.

@vwxyzjn
Copy link
Owner

vwxyzjn commented Aug 19, 2021

Thank you @nkm8 for the contribution. To be honest, I am getting rusted with my own code and also just currently don't have the bandwidth to review. Will find a chance in the following months to review this.

Thanks again.

@nkm8
Copy link
Author

nkm8 commented Aug 19, 2021

@vwxyzjn no worries. If it helps, this is literally a one line code change - you can see it much more clearly with whitespace changes hidden: https://github.com/vwxyzjn/portwarden/pull/34/files?w=1

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

Successfully merging this pull request may close these issues.

None yet

2 participants