Open Bug 1013947 Opened 7 years ago Updated 11 months ago

Remove legacy signons.sqlite files

Categories

(Toolkit :: Password Manager, defect, P5)

defect

Tracking

()

People

(Reporter: Paolo, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: main-thread-io, Whiteboard: [passwords:tech-debt] [lang=js])

Bug 853549 introduces the new "logins.json" file for storing Login Manager data, replacing the legacy "signons.sqlite" file. This SQLite file is kept around and may still be used in case the profile is downgraded.

In a similar way to bug 925101 for the legacy "signons.txt" file, the SQLite file should be deleted after it has not been used for some time.

Note that there might be similarly named files in case a backup was made because of a corrupted database, and these might be deleted as well.

This should not happen on Android, where the SQLite file is still used.
Whiteboard: [passwords:tech-debt]
Priority: -- → P5
The first bug mention in comment 0 should have been bug 853549.

To fix this bug we can add logic to `LoginHelper.removeLegacySignonFiles()`:

* Move the following code https://dxr.mozilla.org/mozilla-central/rev/b7e42143bbbc9dc3e5c05bd1e93b6485ce1d0ad4/browser/components/nsBrowserGlue.js#1982-1984 to the bottom of `_migrateUI`, updating the `if (currentUIVersion < NN) {` accordingly. When testing out this _migrateUI function you will have to rollback the about:config preference "browser.migration.version" to get it to run again.
* Update UI_VERSION to match the above: https://dxr.mozilla.org/mozilla-central/rev/b7e42143bbbc9dc3e5c05bd1e93b6485ce1d0ad4/browser/components/nsBrowserGlue.js#
* Update `LoginHelper.removeLegacySignonFiles`'s `toDeletes` set to include the following (https://dxr.mozilla.org/mozilla-central/rev/b7e42143bbbc9dc3e5c05bd1e93b6485ce1d0ad4/toolkit/components/passwordmgr/LoginHelper.jsm#659,668) 
** signons.sqlite
** signons.sqlite.corrupt
** signons.sqlite-shm
** signons.sqlite-wal (not sure if we even used WAL but just in case some extension did)
* Add signons.sqlite-N.corrupt (where 1 <= N < 10000)[1] to `toDeletes` if they exist.
* Add `Services.prefs.clearUserPref("signon.importedFromSqlite");` to `removeLegacySignonFiles`
* Remove any references to signon.importedFromSqlite by assuming that it's true for any non-Android code.
* We need to be careful not to delete any files on Android. I think we should add an early return in `removeLegacySignonFiles` if we're on Android to be safe.
* Add test tasks to toolkit/components/passwordmgr/test/unit/test_removeLegacySignonFiles.js to cover the code added above.

Let me know if you have any questions. Thanks.

[1] https://dxr.mozilla.org/mozilla-central/rev/b7e42143bbbc9dc3e5c05bd1e93b6485ce1d0ad4/xpcom/io/nsLocalFileCommon.cpp#59
Mentor: MattN+bmo
Whiteboard: [passwords:tech-debt] → [passwords:tech-debt] [lang=js]
Keywords: main-thread-io
Depends on: 1287137
Assignee: nobody → 1991manish.kumar
Type: defect → task

Type: defect → task

This is a defect since we're leaving stale data in profiles.

Type: task → defect
Assignee: 1991manish.kumar → nobody

We should also cleanup signon.importedFromSqlite pref values at the same time.

You need to log in before you can comment on or make changes to this bug.