Closed
Bug 1396224
Opened 8 years ago
Closed 6 years ago
>500kb clipboard data (and text selection on Linux) is written to the filesystem, even in private mode
Categories
(Core :: Widget, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla69
| Tracking | Status | |
|---|---|---|
| firefox69 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
(Blocks 1 open bug)
Details
(Keywords: privacy)
Attachments
(1 file)
Steps to reproduce:
1. Create a file with 500K of data:
python -c 'print("x"*500000)' > file.htm
2. Open the file.htm in a private window.
3. Press Ctrl + A (or Cmd+A) to select everything.
4. If the platform does not have a selection clipboard (e.g. Windows or Mac), press Ctrl+C / Cmd+C to copy it.
5. Look at the temporary directory (TmpD).
/tmp/clipboardcache-xxx (Linux)
$HOME/Library/Caches/TemporaryItems (macOS)
%TMP%\ (Windows)
( the exact locations may differ, get the actual location using Services.dirsvc.get('TmpD', Components.interfaces.nsIFile).path )
Expected:
- Nothing to see.
Actual:
- A bunch of "clipboarcache-" files.
There are already a bunch of bugs about unwanted "clipboardcache" files (bug 1254094 and bug 335545). However, this bug is different, since starting from bug 1123480, it should not be possible for clipboard data to leak:
https://searchfox.org/mozilla-central/rev/2aa0806c598ec433e431728f5ddd3a6847c1a417/widget/nsTransferable.cpp#65-67
(this code is ultimately called when nsITransferable::SetTransferData is used)
The many calls to nsITransferable::Init with parameter null are very suspicious. In particular, IPC-related code does this:
https://searchfox.org/mozilla-central/search?q=nsiTransferable%3A%3Ainit&case=false®exp=false&path=
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
| Assignee | ||
Comment 2•8 years ago
|
||
Is this really a duplicate?
In bug 335545 I fixed the lingering files by referencing the files via a file descriptor instead of file name, which allows us to delete a file as soon as it is created. Until the file descriptor is removed, the file handle can still be used for file I/O.
I thought that in Private browsing mode, all IO is in-memory and not persisted to avoid privacy issues.
Deleting the file descriptor makes it more complicated to recover the clipboard content, but not impossible, as the data is still written to the disk (and can be recovered by treating the disk as a block device).
Do you really consider this issue to be solved? The issues in the code that I pointed out in the report are still open, so I think that this bug should be re-opened.
Flags: needinfo?(jmathies)
Updated•8 years ago
|
Status: RESOLVED → REOPENED
Flags: needinfo?(jmathies)
Resolution: DUPLICATE → ---
Updated•8 years ago
|
Priority: -- → P2
| Assignee | ||
Comment 4•6 years ago
|
||
To avoid populating the clipboard cache,
nsContentUtils::IPCTransferableToTransferable should set the
IsPrivateData flag on the output transferable BEFORE assigning data to
it, not therafter.
This patch includes a new regression test for this specific scenario.
The patch also includes fixes for incorrect IsPrivateData flags in some
other locations with transferable->Init(nullptr), but without unit
tests.
| Assignee | ||
Comment 5•6 years ago
|
||
| str | ||
I've added a patch with basic unit test. To verify (on Linux):
- Create a big file:
python -c 'print("x x "*500000)' > /tmp/big.txt - Open the big file in Firefox.
- Open the terminal, and start the following program to watch file behavior:
inotifywait -m /tmp/ - Select the contents of the tab from step 2 and copy it: Ctrl-A, Ctrl-C
- Look at the terminal.
- Clear the clipboard (e.g. by selecting a small part of the page and pressing Ctrl-C).
- Open the big file in Firefox, in a private window.
- Copy its content by repeating step 4.
- Look at the terminal.
- Clear the clipboard (e.g. by selecting a small part of the page and pressing Ctrl-C).
Expected:
- After step 5, the result should look like the first part of the bottom of https://bugzilla.mozilla.org/show_bug.cgi?id=1433030#c20
- After step 6, the result should look like the second part of the bottom of https://bugzilla.mozilla.org/show_bug.cgi?id=1433030#c20
- After step 9, the terminal should not show any file IO related to
mozilla-temp-files.
Assignee: nobody → rob
Status: REOPENED → ASSIGNED
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/e2e80a9540ff
Avoid cache for private clipboard data r=mstange
Comment 8•6 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago → 6 years ago
status-firefox69:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in
before you can comment on or make changes to this bug.
Description
•