Skip to content
This repository was archived by the owner on Jun 17, 2022. It is now read-only.

Conversation

@djsmith85
Copy link
Contributor

@djsmith85 djsmith85 commented Dec 30, 2021

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

With 1Password changing their export format from .1pif to .1pux in recent versions, this adds an importer to import 1pux into Bitwarden.

The 1pux format is essentially a zip archive including multiple files. The initial one of interest is the export.data file which contains the vault data.

Further information about the new 1pux format can be found here: https://support.1password.com/1pux-format/

Rough overview of imported ciphers/fields:

  • Trashed items are ignored

  • Empty fields are skipped

  • Login items

    • Username
    • Password
    • TOTP
    • Password history
  • CreditCard items

    • Cardholder
    • CC Number
    • CVV
    • Expiry date
    • Card brand is set using CC Number and only to our supported brands
  • Identity items

    • Firstname
    • Initial
    • LastName
    • DefaultPhone
    • Company
    • Email
    • Username
    • Address
  • Import of custom fields (loginfields and sections) for all CipherTypes

    • Fields marked as Date are saved as Unix Epoch and are converted to UTC string
  • Favorites are set

  • Import into folders based on the first entry in tags

  • Import into collection based on the first entry in tags, if the import is ran from within an organization

  • Folder and Collection names are captialized

  • Category Mappings
    1password supports various categories (Item types) which are saved in categoryUuid and are mapped as the following:

  • Bitwarden Login Type:

    • Login
    • Database
    • Password
    • WirelessRouter
    • Server
    • API Credentials
  • Bitwarden CreditCard Type:

    • CreditCard
    • BankAccount
  • Bitwarden Secure Note:

    • SecureNote
    • SoftwareLicense
    • EmailAccount
    • MedicalRecord
  • Bitwarden Identity Type:

    • Identity
    • DriversLicense
    • OutdoorLicense
    • Membership
    • Passport
    • RewardsProgram
    • SocialSecurityNumber

1pux is prepared for including attachments but as of now, they are not included. This will be handled at a later point when 1password has added this feature.

Asana task: https://app.asana.com/0/1153292148278596/1201437354678085/f

Code changes

  • common\src\importers\onepasswordImporters\types\onepassword1PuxImporterTypes.ts: Added types definitions for the export.data file
  • common\src\importers\onepasswordImporters\onepassword1PuxImporter.ts: The actual export.data importer for parsing and importing vaults.
  • \spec\common\importers\testData\onePassword1Pux\*.ts: Several files with test data using when executing the spec
  • \spec\common\importers\onepassword1PuxImporter.spec.ts: Spec including several test cases to validate an import

Testing requirements

Test scenarios will be listed on the web PR.

Before you submit

  • I have checked for linting errors (npm run lint) (required)
  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

@djsmith85 djsmith85 changed the title Add importer for 1Password's new export format (.1pux) WIP: Add importer for 1Password's new export format (.1pux) Dec 30, 2021
@kspearrin
Copy link
Member

Are we requiring users to unzip the file themselves before running our importer?

@djsmith85
Copy link
Contributor Author

Are we requiring users to unzip the file themselves before running our importer?

Not sure yet, wanna see if we are able to upload/unzip it in the web client and pass on the export.data to the importer. That would be the prefered solution.

@djsmith85 djsmith85 changed the title WIP: Add importer for 1Password's new export format (.1pux) Add importer for 1Password's new export format (.1pux) Jan 8, 2022
@djsmith85 djsmith85 marked this pull request as ready for review January 8, 2022 18:26
@djsmith85 djsmith85 requested a review from a team January 27, 2022 12:55
@differsthecat
Copy link
Member

Curious as to how this handles TOTP for free account imports; If we import to a free account, is that data saved and it is later unlocked for the user if they upgrade?

@djsmith85
Copy link
Contributor Author

Curious as to how this handles TOTP for free account imports; If we import to a free account, is that data saved and it is later unlocked for the user if they upgrade?

Yes, the TOTP field from 1P contains the seed value and it gets persisted in the cipher. Once the user purchases premium we start generating TOTP codes. Just verified this with my local test instance

Copy link
Member

@differsthecat differsthecat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, love the super thorough tests!

@djsmith85
Copy link
Contributor Author

Looks great, love the super thorough tests!

Thank you, was loads of work, but this will hopefully aid, if users encounter any issues and encourage devs to add more tests 😉

@djsmith85 djsmith85 merged commit 8e112a1 into master Mar 3, 2022
@djsmith85 djsmith85 deleted the 1pux-importer branch March 3, 2022 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants