Open Bug 1918027 Opened 2 months ago Updated 5 days ago

While inside Google Docs copying another text while a scan is ongoing will scan that text as well

Categories

(Firefox :: Data Loss Prevention, defect)

Desktop
Windows
defect

Tracking

()

REOPENED

People

(Reporter: atrif, Assigned: gstoll)

References

(Blocks 3 open bugs)

Details

Attachments

(7 files, 1 obsolete file)

Attached image dlp_copy_0.gif

Found in

  • 131.0b4

Affected versions

  • 132.0a1 (2024-09-10)
  • 131.0b4

Tested platforms

  • Affected platforms: Windows 11, Windows 10
  • Unaffected platforms:macOS 12, Ubuntu 22

Preconditoins

  • Download the DLP test assets from https://drive.google.com/file/d/1yjqVRuxdKV3WnO7D2wzMgDXBuYBxUgVw/view
  • Create a distribution folder inside the Firefox folder and paste the policies-1.json to it and then rename it to policies.json
  • Run the DLP agent in CMD using: .\content_analysis_sdk_agent.exe --user --toblock=.\d{3}-?\d{2}-?\d{4}. --towarn=.warn. --delays=10

Steps to reproduce

  1. Open Google Docs.
  2. Copy a random text from another application and paste it inside Google Docs.
  3. While the scan is ongoing copy another text inside the clipboard (e.g 123456789)

Expected result

  • Only the first text is scanned.

Actual result

  • The text from step 3 is scanned as well.

Regression range

  • Reproducible with Firefox 131.0b4. We will see if there is a regression.

Additional notes

  • Attached a screen recording.

This is an unfortunate consequence of bug 1915351. Google Docs reads from the clipboard twice, and so if the clipboard contents change during the first scan it will scan the second contents. (most of the time we can skip the second DLP scan since the content is the same; the DLP result gets cached in the cache we added in bug 1912384)

Status: NEW → RESOLVED
Closed: 2 months ago
Duplicate of bug: 1915351
Resolution: --- → DUPLICATE
Attached image 1918027.gif

Hello Greg! It seems that this issue now reproduces on Wikipedia and Gdocs after bug 1915351. With Firefox 132.0 I cannot reproduce the issue on the Wikipedia page, only on Gdocs.

Should we reopen this issue or file another one? Attached a screen recording (Note that I used Ctrl + C / Ctrl + V keyboard shortcut in the recording). Thank you!

Flags: needinfo?(gstoll)

Hi - since this bug was just covering this issue I'll just go ahead and reopen it. Thanks!

Status: RESOLVED → REOPENED
No longer duplicate of bug: 1915351
Flags: needinfo?(gstoll)
Resolution: DUPLICATE → ---

Very rough plan: keep track of the "paste number" for a given paste operation and use the same DataTransfer object for all Content Analysis-related operations in that paste.

Note that this is tricky because JS code inside a paste event is allowed to change the clipboard contents, and after that the new contents should be pasted into the element. Sigh.

See Also: → 1928064
Blocks: 1927131
Assignee: nobody → gstoll

Also fixes a problem with DataTransfer::Clone() where it wasn't propagating
the mClipboardDataSnapshot.

This handles a race condition so if the user copies new data to the clipboard
while Content Analysis is ongoing, the original data will be used in the
paste action.

text/x-moz-url data is supposed to have a newline and a description

This causes asserts in the test when run on Windows but it still passes,
which made me waste a bit of time investigating.

Attachment #9436959 - Attachment description: Bug 1918027 part 3 - add ability for DataTransfer to bypass content analysis r=edgar,#dlp-reviewers! → Bug 1918027 part 2 - add ability for DataTransfer to bypass content analysis r=edgar,#dlp-reviewers!
Attachment #9436960 - Attachment description: Bug 1918027 part 4 - share DataTransfer between clipboard event and calls to HandlePaste() r=edgar,#dlp-reviewers → Bug 1918027 part 3 - share DataTransfer between clipboard event and calls to HandlePaste() r=edgar,#dlp-reviewers
Attachment #9436961 - Attachment description: Bug 1918027 part 5 - add tests r=edgar,#dlp-reviewers → Bug 1918027 part 4 - add tests r=edgar,#dlp-reviewers
Attachment #9436962 - Attachment description: Bug 1918027 part 6 - fix assert in unrelated test r=edgar → Bug 1918027 part 5 - fix assert in unrelated test r=edgar
Attachment #9436958 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: