Closed Bug 1688665 Opened 3 years ago Closed 2 years ago

QuotaCleaner deleteByPrincipal over-clears sessionStorage and legacy localStorage

Categories

(Toolkit :: Data Sanitization, defect, P2)

defect

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: pbz, Assigned: pbz)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 2 obsolete files)

QuotaCleaner#deleteByPrincipal over-clears sessionStorage and legacy localStorage.

It only passes a host here:
https://searchfox.org/mozilla-central/rev/4dac9993b609fccc87e82682614faf2a44cda306/toolkit/components/cleardata/ClearDataService.jsm#473,480
This means that the StorageObserver will clear all localStorage and sessionStorage for a host, without taking origin attributes into account:
https://searchfox.org/mozilla-central/rev/4dac9993b609fccc87e82682614faf2a44cda306/dom/storage/StorageObserver.cpp#294,316

Looking at the interface, it seems that the legacy implementation does not support clearing by full origin: https://searchfox.org/mozilla-central/rev/4dac9993b609fccc87e82682614faf2a44cda306/dom/storage/PBackgroundStorage.ipdl#51

See Also: → 1688221
Blocks: 1550317
Severity: -- → S3
Priority: -- → P3
Summary: QuotaCleaner deleteByPrincipal only clears by host when legacy storage is enabled → QuotaCleaner deleteByPrincipal over-clears sessionStorage and legacy localStorage
Priority: P3 → P2
Blocks: dfpi-hq
Assignee: nobody → pbz
Status: NEW → ASSIGNED

This patch introduces two new observer notifications for clearing sessionStorage and legacy localStorage
by principal / exact origin. This is a requirement for the Clear-Site-Data header which allows sites to clear
storages. For privacy reasons, it's important that a site can only clear the exact storage scope it has access to.
nsIClearDataService will call observer notifications to clear by principal, which are consumed by the
StorageObserver. StorageObserver will forward these messages to SessionStorageManager and LocalStorageManager.

No longer blocks: dfpi-hq

The work here has been blocked on review for many months already. Since this plays an important part in supporting the ClearSiteData header when TCP/dFPI is enabled, I think it would be good to get it landed soon.

Andrew, Jan, could you or somebody from your team please take a look at the patches? They are relatively simple. Happy to connect via Zoom or Slack too if it's helpful. Thanks!

Flags: needinfo?(jvarga)
Flags: needinfo?(bugmail)
Flags: needinfo?(bugmail) → needinfo?(jstutte)

Jan will get to this very soon, sorry for the delay.

Flags: needinfo?(jstutte)
Depends on: 1757372

The original patch D121639 has been developed by pbz.

Depends on D139812

The original patch D121640 has been developed by pbz.

Depends on D139813

Attached patch interdiff1.diffSplinter Review
Flags: needinfo?(jvarga)
Attachment #9234478 - Attachment is obsolete: true
Attachment #9234479 - Attachment is obsolete: true
Pushed by jvarga@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8010a4d4ffc9
Support for clearing sessionStorage by principal; r=pbz
https://hg.mozilla.org/integration/autoland/rev/d9329294168f
Updated tests for clearing localStorage and sessionStorage by principal; r=pbz
Regressions: 1760793
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: