Closed Bug 2067877 Opened 2 months ago Closed 1 month ago

Add support for analyzing clipboard copy operations in DLP

Categories

(Firefox :: Data Loss Prevention, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: gstoll, Assigned: gstoll)

References

(Blocks 2 open bugs)

Details

Attachments

(7 external files)

No description provided.

Adds the configuration surface for analyzing clipboard copy operations:

browser.contentanalysis.interception_point.clipboard_copy.enabled
browser.contentanalysis.interception_point.clipboard_copy.plain_text_only

and the corresponding ContentAnalysis.InterceptionPoints.ClipboardCopy
enterprise policy. Later patches in this series read these prefs when
doing the copy analysis.

enabled defaults to false so that existing content analysis deployments
are unaffected.

Assignee: nobody → gstoll
Status: NEW → ASSIGNED

No real behavior changes here, just setting up for later patches.

Nothing creates copy requests yet, so this has no effect until later patches.
Tests are in part 5.

Preparation for the next patch, which needs to defer a clipboard write
until an asynchronous content analysis check has answered.

Moves the body of SetData into SetDataImpl, which takes an optional
completion that is handed the final result. AsyncSetClipboardData::SetData
now notifies its nsIAsyncClipboardRequestCallback from that completion
instead of from the return value.

The content analysis check is added to nsBaseClipboard::SetData since
every content-initiated clipboard write passes through there. When a copy
needs analyzing the write is held back as a PendingCopy, the check runs
asynchronously, and the data reaches the clipboard only once the agent
allows it.

The check is deliberately asynchronous (unlike paste), since nothing
waits on a copy verdict.

Some notes:

  • A newer write replaces the PendingCopy, which makes the older verdict a
    no-op, so the write issued last always wins no matter which verdict
    arrives first. EmptyClipboard and the destructor cancel pending copies.
  • A blocked copy replaces the clipboard contents with a localized notice
    rather than leaving them alone, so that the user cannot silently paste
    whatever was there beforehand.
  • The content process never learns the verdict, so a blocked cut still
    deletes the selection. The deletion is a single undo transaction, so
    Ctrl+Z restores it.
  • As with paste, we don't analyze copies coming from chrome or
    parent-rendered windows.

Like paste, we need to treat alert()/confirm()/prompt() specially, since
they are from chrome which are normally exempt, but their content comes
from a page.

Unlike the usual path, this one knows the verdict before deciding whether
to delete, so a blocked cut here leaves the text in place.

Blocks: 2071331
Pushed by gstoll@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/20d706b79d13 https://hg.mozilla.org/integration/autoland/rev/2a6535a01e2d part 1 - Add clipboard_copy content analysis prefs, enterprise policy and telemetry. r=jneuberger,dlp-reviewers,jmendez,handyman https://github.com/mozilla-firefox/firefox/commit/b9a15c157dd0 https://hg.mozilla.org/integration/autoland/rev/cb37a08fb1af part 2 - Thread the request reason through clipboard content analysis requests. r=dlp-reviewers,handyman https://github.com/mozilla-firefox/firefox/commit/3e89b801f7bb https://hg.mozilla.org/integration/autoland/rev/7a72ac62fafd part 3 - Say "copy" rather than "paste" in content analysis dialogs for copies. r=dlp-reviewers,fluent-reviewers,bolsson,handyman https://github.com/mozilla-firefox/firefox/commit/8f6e812bb0d4 https://hg.mozilla.org/integration/autoland/rev/0c1ec7518cd6 part 4 - Give nsBaseClipboard::SetData an optional completion callback. r=edgar https://github.com/mozilla-firefox/firefox/commit/5a1b7e10cf4e https://hg.mozilla.org/integration/autoland/rev/291e2d0ab86c part 5 - Analyze clipboard copies from web content. r=edgar,dlp-reviewers,fluent-reviewers,bolsson,handyman,ipc-reviewers https://github.com/mozilla-firefox/firefox/commit/6ade0a1be950 https://hg.mozilla.org/integration/autoland/rev/098bd7a12e05 part 6 - Analyze clipboard copies from alert() and prompt() dialogs. r=dlp-reviewers,handyman
Blocks: 2074118
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: