Bug 169632 - In WK1, deleting localstorage for a single origin can leak data
Summary: In WK1, deleting localstorage for a single origin can leak data
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-14 14:48 PDT by Ansh Shukla
Modified: 2017-03-14 14:57 PDT (History)
1 user (show)

See Also:


Attachments
Patch v1 (3.66 KB, patch)
2017-03-14 14:52 PDT, Ansh Shukla
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ansh Shukla 2017-03-14 14:48:49 PDT
This is an issue with the -[WebStorageManager deleteOrigin:] API. Calling this method tries to delete the localstorage database file on disk in StorageTracker::syncDeleteOrigin. However, we currently only delete the database file and none of its associated temporary SQLite files. One of the temporary files we fail to delete is the write-ahead log which contains local storage data that hasn’t been checkpointed. The net result is that if we wipe the local storage database and then recreate it, SQLite retains any “deleted” data that was kept around in the WAL.

By default the WAL only checkpoints (i.e. moves data into the database) every 1000 pages. This is a significant amount of data we could potentially leak.

We should fix this by also deleting the temporary files. We already have a method to do so in SQLiteFileSystem.
Comment 1 Ansh Shukla 2017-03-14 14:52:40 PDT
Created attachment 304430 [details]
Patch v1

This patch moves to using deleteDatabaseFile.
Comment 2 Ansh Shukla 2017-03-14 14:53:19 PDT
I've looked into trying to test this change, but I can't find anything which actually exercises our WK1 local storage APIs. We seemed to have something for this, but removed it in: https://bugs.webkit.org/show_bug.cgi?id=140044
Comment 3 Brady Eidson 2017-03-14 14:57:23 PDT
(In reply to comment #2)
> I've looked into trying to test this change, but I can't find anything which
> actually exercises our WK1 local storage APIs. We seemed to have something
> for this, but removed it in: https://bugs.webkit.org/show_bug.cgi?id=140044

This will need (an) API test(s)