Coder Social home page Coder Social logo

1password-csv-fix's Introduction

1password-csv-fix

What

This is a commandline tool to identify and correct invalid URLs in your 1Password vault. It's designed to be run from a Terminal. I built and tested it on macOS, but it should run on Windows or Linux as well with little or no modification.

The script can identify vault items that have invalid (merged) comma-separated URLs, such as:

https://mysite1.foo,http://10.20.30.40,https://myotherurl.foo

It can repair these items, splitting the URLs back into separate fields so that autofill works properly.

Why

This can happen after an export/import from another tool (in my case Bitwarden), due to the differing formats and capabilities of the password managers, combined with the limitations of the CSV format. See this thread from the 1Password forum for example.

How

Installation

Download the latest release and place the 1password-csv-fix.sh file in your system's $PATH. I recommend /usr/local/bin, but anywhere will do.

There are some prerequisites that need to be installed:

  • bash shell - built into macOS & Linux, on Windows use WSL (wsl --install)
  • op - official 1Password CLI
  • jq - for JSON processing
  • fzf - for selecting and acting on multiple items

(if any of these are missing, the script will notify you and abort)

Usage

Open a Terminal and run 1password-csv-fix.sh. Without any arguments (or with -h/--help), the helptext will be displayed:

$ 1password-csv-fix.sh -h
usage: 1password-csv-fix.sh [opts]
    -a,--all                  show all items (tab-separated: ID, Name, URL)
    -g,--get                  get JSON for a single item
    -s,--search <query>       search (regex, within URL)
    -o,--open <item>          open item in 1Password UI
    -e,--edit [item]          edit item in 1Password UI (use `last` for most recent)
    -u,--urls [item]          show URLs (if no item arg is supplied, show all)
    -l,--long                 list items with invalid CSV URLs
    -r,--raw                  raw JSON output of `item list`
    --fix <item>              repair invalid comma-separated URLs from CSV import
    --fix-multi               use fzf to select multiple items (to fix)
    --del-multi               use fzf to DELETE multiple items
    --del-field <fieldname>   recursively remove a field (if empty) from multiple items

To fix a single item (pass the item ID as the argument):

1password-csv-fix.sh --fix zyauxs3ataermfxiv7qaaznmrq

To fix multiple items at once (if there are no invalid URLs detected, this will be a no-op):

1password-csv-fix.sh --fix-multi

⚠️ Danger Zone ⚠️

To delete fields (e.g. if an unused field is left over after an import):

1password-csv-fix.sh --del-field <fieldname>

To delete entire item(s) from the vault:

1password-csv-fix.sh --del-multi

Help

I've used this to repair hundreds of items and it has worked well, but there could always be edge cases. As with any 3rd party tool, please use caution and make sure you have a good backup of your vault in case something goes wrong.

Feel free to reach out on the forum or file an issue if you run into a problem!

1password-csv-fix's People

Contributors

luckman212 avatar

Stargazers

Alex Angas avatar  avatar

Watchers

 avatar

1password-csv-fix's Issues

Ordinary users can't write to /tmp

Running with a "Standard" user under Fedora (KDE) throws an error, as the user does not have permission to write to /tmp.

Obviously no issue with an "Administrator" user.

(By the way - this is the last issue, everything else has worked great. Thank you so much once again!)

open: command not found

Firstly, thank you so much for this script. Without meaning any offence, I was not expecting something so professional. It's very well done, kudos!

An issue I encountered when running ./1password-csv-fix.sh --fix 6fb47idj567csrhpi7ytsvpk5a

./1password-csv-fix.sh: line 97: open: command not found

I'm running the script on Linux - that may be why. The script had already successfully corrected the entry in 1Password.

jq: error: col/1 is not defined

When running ./1password-csv-fix.sh --fix-multi

I get the error:

jq: error: col/1 is not defined at <top-level>, line 2:
        [ .id, (.title|col(25)), .urls[0].href ] | @tsv                
jq: 1 compile error

I'm not familiar with jq so not sure what this means. If it helps, the version installed on my system is jq-1.7.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.