Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new pdfjs.enablePermissions preference, off by default, to allow the PDF documents to disable copying in the viewer (bug 792816) #11789

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Apr 8, 2020

Recently I've been looking through some older issues/bugs, to see if there's any ones that are now easy to address; this is a simple one that I found.


Please note: Most of the necessary API work was done in PR #10033, and the only remaining thing to do here was to implement it in the viewer.

The new preference should thus allow e.g. enterprise users to disable copying in the viewer, for PDF documents whose permissions specify that.

In order to simplify things the "copy"-permission was implemented using CSS, as suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=792816#c55, which should hopefully suffice.[1]
The advantage of this approach, as opposed to e.g. disabling the textLayer completely, is first of all that it ensures that searching still works correctly even in copy-protected documents. Secondly this also greatly simplifies the overall implementation, since it doesn't require a lot of code for something that's disabled by default.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=792816 (assuming we care to do so).
Fixes #3471
/cc @brendandahl


[1] As the discussion in the bug shows, this kind of copy-protection is not very strong and is also generally easy to remove/circumvent in various ways. Hence a simple solution, targeting "regular"-users rather than "power"-users is hopefully deemed acceptable here.

@Snuffleupagus Snuffleupagus force-pushed the bug-792816 branch 4 times, most recently from ce4a465 to 0e4daad Compare April 8, 2020 16:16
…low the PDF documents to disable copying in the viewer (bug 792816)

*Please note:* Most of the necessary API work was done in PR 10033, and the only remaining thing to do here was to implement it in the viewer.

The new preference should thus allow e.g. enterprise users to disable copying in the viewer, for PDF documents whose permissions specify that.

In order to simplify things the "copy"-permission was implemented using CSS, as suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=792816#c55, which should hopefully suffice.[1]
The advantage of this approach, as opposed to e.g. disabling the `textLayer` completely, is first of all that it ensures that searching still works correctly even in copy-protected documents. Secondly this also greatly simplifies the overall implementation, since it doesn't require a lot of code for something that's disabled by default.

---
[1] As the discussion in the bug shows, this kind of copy-protection is not very strong and is also generally easy to remove/circumvent in various ways. Hence a simple solution, targeting "regular"-users rather than "power"-users is hopefully deemed acceptable here.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Apr 8, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/9cfa11ee9e1f28a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 8, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/9cfa11ee9e1f28a/output.txt

Total script time: 2.56 mins

Published

@mkaply
Copy link

mkaply commented Apr 8, 2020

Was 10003 already merged into Firefox?

@Snuffleupagus
Copy link
Collaborator Author

Was 10003 already merged into Firefox?

Yes, it landed all the way back in Firefox 64 (see https://bugzilla.mozilla.org/show_bug.cgi?id=1488420); assuming that you meant #10033 of course :-)

@mkaply
Copy link

mkaply commented Apr 8, 2020

Great. As soon as this lands in Firefox, I'll create an enterprise policy to enable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Security: Ignores protection from Copy
5 participants