Leon's Weblog

November 30, 2008

Distributing Bookmarks over a Secure RSS Feed

Filed under: Software Dev — Leon @ 1:17 am

Background
The goal was to create a simple and secure way to distribute and synchronize bookmarks across multiple desktops, different browsers, and different operating systems anywhere in the world. I run Linux as my primary desktop and Konqueror as the default browser (which I used to collect hundreds of links). I have tried using services like Del.icio.us and various Firefox plugins but none were ideal. Services require settings up an account on a public server which present some privacy concerns. Even if the account is private, the host will use your data for marketing and social networking. Why would you want someone knowing what stores you shop at and which financial institutions you use (even if they claim to be anonymous)? Plugins have their own problems by limiting users to a particular browser and requiring importing/exporting the Bookmarks on each browser.

The solution involves distributing the Bookmarks over a secure RSS feed and using Firefox’s Live Bookmarks feature to display the feed. Since Firefox displays the RSS feeds directly in the Bookmarks menu, the list of links looks like it was there all along. Fortunately, other browsers are starting to implement similar functionality and the Bookmarks can even be published on online RSS readers.

Security
I wanted to keep my Bookmarks private so security was a concern. The RSS Feed can be distributed over a secured connection (HTTPS) and password protected using Basic Access Authentication. Until recently, secured RSS feeds were not universally supported by RSS readers; but, as of Firefox 3, this setup works as it should. Firefox even tracks login credentials so you will not be prompted to login each time that the Live Bookmarks folder is opened.

Implementation
I implemented the RSS feed using PHP and an Apache Web Server. There are plenty of guides for publishing RSS feeds using PHP so I won’t get into the details here. Settings up a secure web server and Basic Authentication is fairly straight forward in Apache. I guess this solution is less then ideal if you don’t already have a working Web server with PHP support.

The brunt of the work involved reading the configuration file containing the bookmarks from Konqueror into a PHP array and outputting it in Atom 2.0 format.

Limitations
It would have been great if different channels in a single RSS feed showed up in their own sub-folder. Unfortunately Firefox does not support having sub-folders as part of a Live Bookmarks feed. Firefox only loads the first “channel” section of the XML file, ignoring the rest.

To compensate for this shortcoming, I prefixed each link with the desired folder name(s) such that each link was a canonical path. Another solution is to pass query string parameters to the the script that generates the RSS feed to indicate which Bookmarks folder to load. With this approach, you can even implement a dynamic search of your bookmarks.