I don't know if Lastpass started doing this after the Lastpass import
script was written, but the CSV export is now escaped as HTML. That
means that any passwords are imported incorrectly if they have ampersands.

This would be fairly easy to correct, there is a "cgi" module that
provides a function "CGI.unescapeHTML" that processes these entities
back into single characters. I've attached a patch that does this.
-- 
Robert Richter
https://about.me/robert.richter
<https://about.me/robert.richter?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links>

Attachment: 0001-Escape-HTML-entities.patch.sig
Description: PGP signature

From 8cf6ba053e2f074becb94fb45b43840cb0e9fe95 Mon Sep 17 00:00:00 2001
From: Robert Richter <[email protected]>
Date: Sat, 16 Jul 2016 11:26:09 -0500
Subject: [PATCH] Escape HTML entities

The Lastpass CSV export escapes HTML entities, so any passwords containing
ampersands are imported incorrectly. This change requires the "cgi" module,
which is in Ruby's standard library.
---
 contrib/importers/lastpass2pass.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/importers/lastpass2pass.rb b/contrib/importers/lastpass2pass.rb
index bf46c8c..c8a931f 100755
--- a/contrib/importers/lastpass2pass.rb
+++ b/contrib/importers/lastpass2pass.rb
@@ -91,9 +91,10 @@ rescue
 end
 
 # Parse records and create Record objects
+require 'cgi'
 records = []
 entries.each do |e|
-  args = e.split(",")
+  args = CGI.unescapeHTML(e).split(",")
   url = args.shift
   username = args.shift
   password = args.shift
-- 
2.9.1

Attachment: 0xFD583641.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to