Skip to content

fix: keep TOTP from KeePassXC and Lastpass CSV exports - #249

Closed
jayhemnani9910 wants to merge 2 commits into
pass-extension:masterfrom
jayhemnani9910:fix/keepassxc-csv-totp
Closed

jayhemnani9910 wants to merge 2 commits into
pass-extension:masterfrom
jayhemnani9910:fix/keepassxc-csv-totp

Conversation

@jayhemnani9910

Copy link
Copy Markdown

Importing a KeepassXC or Lastpass CSV export drops every TOTP secret. KeepassXC 2.6+ writes the otpauth URL in a TOTP column (Database > Export > CSV):

"Group","Title","Username","Password","URL","Notes","TOTP","Icon","Last Modified","Created"
"Root/Email","Gmail","bob@gmail.com","pw","https://mail.google.com","","otpauth://totp/Google:bob?secret=JBSWY3DPEHPK3PXP&period=30&digits=6&issuer=Google","0","2026-01-01T10:00:00Z","2025-01-01T10:00:00Z"

Lastpass (its only export is CSV) has a totp column with the base32 secret:

url,username,password,totp,extra,name,grouping,fav
https://github.com/login,alice,pw1,JBSWY3DPEHPK3PXP,,GitHub,Dev,0

pimport pass keepassxc export.csv -o store (or lastpass) writes the password, login and url, but no otpauth:// line, and gives no warning. With --all the value is kept as TOTP: otpauth://..., which pass-otp does not read. Anyone moving from KeepassXC with this export loses their 2FA seeds.

KeepassxcCSV uses the Keepassx2CSV keys, which have no TOTP column (KeepassX had no TOTP), and LastpassCSV.keys has no totp either. The KDBX importer already reads OTP. Both parse methods now move the value to otpauth: for KeepassXC only an otpauth:// URL, for Lastpass the secret, which clean.otp turns into an otpauth:// URL. I did not add the columns to keys, because checkheader would then reject older exports without them (KeepassXC before 2.6, older Lastpass exports, and the existing test assets).

Added keepassxc-totp.csv and lastpass-totp.csv with one test each; both fail without the change. green tests: all pass except test_import_gnome_keyring, which fails the same way without the change here (no keyring daemon). Imported both files into a pass store and decrypted the entries: the otpauth:// line is there now (before: missing).

KeepassxcCSV inherits the KeepassX2 keys, which have no TOTP column, so the otpauth URL that KeepassXC 2.6+ writes there was dropped (or kept as 'TOTP: otpauth://...' with --all, which pass-otp does not read). Map it to otpauth. It is not added to keys so older exports without the column still parse.
Lastpass exports the TOTP secret in a totp column, which LastpassCSV did not map, so it was dropped. Map it to otpauth; clean.otp builds the otpauth URL from the secret. Older exports without the column still parse.
@roddhjav
roddhjav deleted the branch pass-extension:master November 22, 2026 23:53
@roddhjav roddhjav closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants