Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include TOTP settings in CSV export #3541

Closed
lonelymaw opened this issue Sep 15, 2019 · 15 comments · Fixed by #5346
Closed

Include TOTP settings in CSV export #3541

lonelymaw opened this issue Sep 15, 2019 · 15 comments · Fixed by #5346
Milestone

Comments

@lonelymaw
Copy link

lonelymaw commented Sep 15, 2019

Summary

Currently, exporting a database as a .csv as far as I can tell only includes the bare information fields, i.e., Group, Title, Username, Password, URL, and Notes.

Desired Behavior

Expected behavior would be for other important fields, such as AutoType window associations, to be included, such that re-importing the .csv into KeePassXC would yield an exact copy of the original.

Context

There have been times I've needed to edit a field currently not editable in KeePassXC -- creation or access dates, for example -- and have needed to export them as a .csv file, edit them, then re-import them to do so. Current behavior then requires me to re-enter any window association information for AutoType, which can be tedious and time-consuming.

@louib louib changed the title Include AutoType window associations in exported .csv file Include missing fields in exported .csv file Sep 15, 2019
@louib
Copy link
Member

louib commented Sep 15, 2019

Yeah that would be nice to have, especially when we'll be able to import and export from the CLI (#3278 is still a work in progress).

@droidmonkey
Copy link
Member

The problem is you get unbounded results which do not play well with csv. Sure we could encode the information (base64 for example) but that really isn't the point of csv export. It is not intended for you to edit the time and reimport. Its meant to cross over to another password manager (no data lock) that most likely doesn't support these features anyway, and certainly wouldn't understand the import of that information.

@louib
Copy link
Member

louib commented Sep 17, 2019

But we have that problem already, no? There could be commas in the password or in the notes already. At that point we could export everything there is for an entry and let the users decide what fields they want to use.

@droidmonkey
Copy link
Member

Any reserved keywords are escaped per csv convention. The problem isn't commas, it's multi-dimensional data. You either create a new column for each Auto-Type entry, only export 1 or 2, or whatever. Its not a trivial problem.

@louib
Copy link
Member

louib commented Sep 17, 2019

I guess we could at least export "standard" fields like uuid, modification and access dates. Expiration date and TOTP attributes could make sense too.

@droidmonkey
Copy link
Member

Yes agree we should at least export the Created and Modified times. TOTP settings is also good. Anything that can be imported by CSV should be exported to CSV.

@llucax
Copy link

llucax commented Oct 27, 2019

I think it is important to have a text format that can be used to export the DB without loss of information. although I agree CVS might not be the best choice. I think keepass2 uses an XML file for that. Right not there seems to be some wrong date in my database and I can't find a way to "debug" this problem, as the only export option I have doesn't include the dates, so I have no way to easily search the DB for potential problems.

As a side note, it seems I'm not the only one experiencing this issue, which makes the DB unreadable for the Android App keepass2android. See PhilippC/keepass2android#868. But this is probably for a different issue.

@droidmonkey
Copy link
Member

droidmonkey commented Oct 27, 2019

You can use the cli tool to export to xml: keepassxc-cli export xml [db path]

@llucax
Copy link

llucax commented Oct 27, 2019

Oh, cool, thanks! I didn't know that. I finally identified the problem. I recently migrated all my passwords from Firefox to keepass and the Firefox password export tool (FF Password Exporter) uses a weird unix timestamp to represent dates. It adds 3 more digits at the end, I assume representing sub-second time. These were then interpreted as regular unix timestamps by the keepassxc importer and thus making the dates in a very distant future. I just wrote a small script to remove those extra 3 digits from the timestamps and re-imported and that made my issue go away.

@pmajkutewicz
Copy link

A lot of sites have 2FA now.
Exporting TOTP config is like "must-have" in my opinion.

If I do export-import now I won't be able to login to the site with 2FA enabled.

@droidmonkey droidmonkey changed the title Include missing fields in exported .csv file Include TOTP settings in CSV export Aug 19, 2020
@droidmonkey droidmonkey added this to the v2.6.2 milestone Aug 19, 2020
@friend18
Copy link

I realize that this is a complex problem, whose complete (and satisfying) resolution may be a long-ish time coming.
In the meantime, though, please revise the cautionary message (issued when first exporting a database into a CSV file) to include something to the effect of "not all information in the database will be written into the CSV file" (and make that text in Italics/Bold). Possible further refinement could enumerate either what is written, or what is not written (or even issue the additional diagnostic iff there would be information loss) -- but what I'm suggesting would clarify that writing/reading-back a CSV file loses information. I'm speaking as someone who was just burned by this now-discovered fact.

@droidmonkey
Copy link
Member

I got a fix ready for 2.6.2

droidmonkey added a commit that referenced this issue Aug 26, 2020
* Fixes #3541
* CSV export now includes TOTP settings, Entry Icon (database icon number only), Modified Time, and Created Time.
* CSV import properly understands time in ISO 8601 format and Unix Timestamp.
* CSV import will set the TOTP settings and entry icon based on the chosen column.
droidmonkey added a commit that referenced this issue Sep 1, 2020
* Fixes #3541
* CSV export now includes TOTP settings, Entry Icon (database icon number only), Modified Time, and Created Time.
* CSV import properly understands time in ISO 8601 format and Unix Timestamp.
* CSV import will set the TOTP settings and entry icon based on the chosen column.
@pmajkutewicz
Copy link

pmajkutewicz commented Oct 22, 2020

@droidmonkey Now I'm lost.
I was waiting for this release long time. Now I have 2.6.2 (AppImage) and I did export to csv.
Following columns are exported
"Group","Title","Username","Password","URL","Notes"

So... where is TOTP? Do I have to change settings?

To be on same page... I think that all settings are here
totp

@droidmonkey
Copy link
Member

droidmonkey commented Oct 22, 2020

Oh no! That commit was merged to develop and not the 2.6.2 release branch. You can achieve your goal by running a snapshot appimage: https://snapshot.keepassxc.org

@pmajkutewicz
Copy link

Oh... now i see. Works like a charm. Thank You!

@droidmonkey droidmonkey modified the milestones: v2.6.2, v2.7.0 Oct 24, 2020
droidmonkey added a commit that referenced this issue Dec 6, 2020
* Fixes #3541
* CSV export now includes TOTP settings, Entry Icon (database icon number only), Modified Time, and Created Time.
* CSV import properly understands time in ISO 8601 format and Unix Timestamp.
* CSV import will set the TOTP settings and entry icon based on the chosen column.
droidmonkey added a commit that referenced this issue Dec 6, 2020
* Fixes #3541
* CSV export now includes TOTP settings, Entry Icon (database icon number only), Modified Time, and Created Time.
* CSV import properly understands time in ISO 8601 format and Unix Timestamp.
* CSV import will set the TOTP settings and entry icon based on the chosen column.
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 a pull request may close this issue.

6 participants