Closed Bug 1713619 Opened 3 years ago Closed 5 months ago

PDF thumbnails not working when privacy.resistFingerprinting enabled

Categories

(Core :: Graphics: Canvas2D, defect)

58 Branch
x86_64
Windows 10
defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox-esr91 --- wontfix
firefox-esr115 123+ fixed
firefox88 --- wontfix
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- wontfix
firefox93 --- wontfix
firefox94 --- wontfix
firefox95 --- wontfix
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- fixed

People

(Reporter: sr1.mozbugzilla, Assigned: tschuster)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

  1. In about:preferences, under Applications, set action for PDF documents to "Open in Firefox".
  2. Enable privacy.resistFingerprinting.
  3. Navigate to a URL that returns a PDF document that can be displayed by Firefox. For example, navigate to https://web.pa.msu.edu/people/duxbury/courses/phy480/Cpp_refcard.pdf.
  4. Firefox may display a 'Allow pdf.js t use your HTML5 canvas image data?' dialog near the address bar. If displayed, ignore the prompt or click on [X] 'Close this message' in top-right corner of the dialog.
  5. If Sidebar is not visible, click on Toggle Sidebar button to display the sidebar.

Actual results:

Sidebar displays thumbnails of PDF document pages. Each thumbnail is a white rectangle hatched with a different colour. Thumbnails are not actual representations of the PDF pages.

Work-around:

  1. Allow HTML5 canvas for the specified URL.
  2. Refresh page.

Expected results:

Each thumbnail in the sidebar should be a faithful representation of the actual PDF document page, regardless of privacy.resistFingerprinting setting.
Firefox internal PDF viewer should not need to ask for canvas permissions.

The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → PDF Viewer
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

Yes; we should be able to allow these thumbnails through (I'm assuming that pdf JS can't read DOM data.)

Status: UNCONFIRMED → NEW
Ever confirmed: true

It looks like this was discussed ~5 years ago on tor trac and on the pdf.js github, the conclusion then seems to be giving pdf.js an exemption from the canvas routines. My quick guess is that pdf.js's recent move to being an addon from an extension broke those special privileges and they need to be reinstated.

QA Whiteboard: [qa-regression-triage]
Has Regression Range: --- → yes
Regressed by: 967895

While I really cannot claim to understand the following code https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/dom/canvas/CanvasUtils.cpp#82-87, I nonetheless cannot help thinking that the particular file-check used there isn't correct.

Note that the (thumbnail) canvases are not being created in that particular file, and the following search suggests that most call-sites (be it in C++ or JS code) are checking the principal or origin for "resource://pdf.js/web/viewer.html" respectively "resource://pdf.js".

Maybe the code in CanvasUtils.cpp could simply utilize this existing helper: https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/dom/base/nsContentUtils.cpp#6717-6725, unless I'm completely misunderstanding things?

Severity: S4 → --
Component: PDF Viewer → Canvas: 2D
Priority: P3 → --
Product: Firefox → Core
Version: Firefox 88 → 58 Branch

The severity field is not set for this bug.
:lsalzman, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman) → needinfo?(aosmond)
Severity: -- → S4
Flags: needinfo?(aosmond)
See Also: → 1582021
Depends on: 1856732
Assignee: nobody → tschuster
Status: NEW → ASSIGNED
Pushed by tschuster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8cd1fc9da2b4
Exempt chrome/resource (incl PDF.js) principals from canvas randomization/placeholders. r=lsalzman

Why do we need this? What's wrong in my assumption in Bug 1830629 that our current exemption for resource:// isn't sufficient?

See Also: → 1830629

Because when we are in Document::RecomputeResistFingerprinting we are using the mChannel, which in this case has the principal/uri of e.g. https://web.pa.msu.edu/people/duxbury/courses/phy480/Cpp_refcard.pdf.

The exemption uses the SubjectPrincipal, which will be the actual principal of the running pdf.js code.

Okay, gotcha, thanks

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

The patch landed in nightly and beta is affected.
:tschuster, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox122 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(tschuster)

Long standing minor bug in a non-default config => wontfix.

Flags: needinfo?(tschuster)

[Tracking Requested - why for this release]: Would it be possible to backport this to ESR for Tor?

(In reply to Tom Ritter [:tjr] from comment #16)

Would it be possible to backport this to ESR for Tor?

We would need a new patch for ESR. Really should have a test for this too.

Flags: needinfo?(tschuster)

Comment on attachment 9370871 [details]
Bug 1713619 - ESR 115: Exempt chrome/resource principals from canvas randomization/placeholders. r?lsalzman

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: This is a longstanding issue with privacy.resistFingerprinting, that we want to fix (mostly) for TOR.
  • User impact if declined: PDF.js sidebar is unusable in certain configurations.
  • Fix Landed on Version: 123
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Manually verified on ESR and verified on Nightly. Non-default config impacted.
Flags: needinfo?(tschuster)
Attachment #9370871 - Flags: approval-mozilla-esr115?
Flags: needinfo?(tschuster)
Flags: needinfo?(tschuster)
Pushed by tschuster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c9b705d69a04
Test canvas placeholder exemption for pdf.js. r=tjr
Backout by abutkovits@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/06986c8d3305
Backed out changeset c9b705d69a04 for causing failures at PerformanceMainThread.cpp.
Blocks: 1873405

Comment on attachment 9371275 [details]
Bug 1713619 - Test canvas placeholder exemption for pdf.js. r?tjr

Revision D197779 was moved to bug 1873405. Setting attachment 9371275 [details] to obsolete.

Attachment #9371275 - Attachment is obsolete: true
QA Whiteboard: [qa-regression-triage] → [qa-regression-triage] [qa-123b-p2]

Comment on attachment 9370871 [details]
Bug 1713619 - ESR 115: Exempt chrome/resource principals from canvas randomization/placeholders. r?lsalzman

Approved for ESR

Attachment #9370871 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: