Seed RequestPolicy from 1Password

I recently rebuilt my laptop from scratch, and while installing the most excellent NoScript, someone suggested to install RequestPolicy as a companion extension. I have played with RequestPolicy in the past but ended up uninstalling it for one reason or another. I was about to uninstall it again after having to continuously toggle policies on things for new websites I visited (this being a fresh install of everything).

I decided to try to seed RequestPolicy with a list of domains from 1Password. Both 1Password and RequestPolicy have plain-text import/export mechanisms, so I fired up ruby and wrote a simple little script to take the 1Password export of the ‘URL/Location’ field, and convert it to a format which RequestPolicy likes.

In order to use the following script, you will need the following:

1. Ruby
2. This Gist
3. Export ONLY your 1Password ‘URL/Location’ field. Open 1Password and click on the File -> Export All -> Text File… and uncheck all but the ‘URL/Location’ field. (This is very tedious, but you only have to do it once)

Export 'URL/Location' field

Once you are set, fire up the script like so:

# chmod u+x 1p2rp.rb
# ./1p2rp.rb --in /path/to/1password/export.file --out /path/to/save/request_policy_import.file

Once complete, import /path/to/save/request_policy_import.file into RequestPolicy using the Import function of the extension. Enjoy your 1Password saved websites being white-listed by default.