Add support for encrypted attachments#21234
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21234 +/- ##
==========================================
- Coverage 81.42% 81.41% -0.02%
==========================================
Files 257 257
Lines 65351 65368 +17
==========================================
+ Hits 53212 53219 +7
- Misses 12139 12149 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a618a1f to
64ecd4c
Compare
calixteman
reviewed
May 15, 2026
calixteman
reviewed
May 15, 2026
64ecd4c to
2faecb8
Compare
This PR is related to mozillaGH-20732, which is about `AuthEvent` (to delay promting for a password), but instead adds the actual support for encrypted attachments. “Encrypted attachments” means that the main things are plain text. Note that some PDF viewers, like Preview/QuickLook/Safari or Chrome, do not support attachments at all. Note that the file checked into the tests is the same as `output-no-auth-event.pdf` referenced in <mozilla#20139 (comment)>. Closes mozillaGH-20139.
2faecb8 to
45cdb5d
Compare
Collaborator
Author
|
nits applied, rebased, and squashed! |
Contributor
|
/botio-linux browsertest |
Collaborator
From: Bot.io (Linux m4)ReceivedCommand cmd_browsertest from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/3b2e75b8a0763a8/output.txt |
Collaborator
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/3b2e75b8a0763a8/output.txt Total script time: 18.25 mins
|
wooorm
added a commit
to wooorm/pdf.js
that referenced
this pull request
Jun 1, 2026
Normally entire PDFs are encrypted (or not). But it is also possible to only encrypt attachments. It is then also possible to *only* prompt for a password when the user opens them. In the existing flow, prompting for passwords happens because things are decrypted. A specific error is thrown, caught, and the user is prompted. To keep this flow working, this PR changes to decrypting attachments on demand, instead of eagerly. This sounds logical: to not read attachments on startup. I’ve extensively tested this, not only with regular attachments, but also with outline items and attachments in annotations. This PR builds on mozillaGH-21234. It’s an alternative to the naïve mozillaGH-20732. Closes mozillaGH-20049.
wooorm
added a commit
to wooorm/pdf.js
that referenced
this pull request
Jun 3, 2026
Normally entire PDFs are encrypted (or not). But it is also possible to only encrypt attachments. It is then also possible to *only* prompt for a password when the user opens them. In the existing flow, prompting for passwords happens because things are decrypted. A specific error is thrown, caught, and the user is prompted. To keep this flow working, this PR changes to decrypting attachments on demand, instead of eagerly. This sounds logical: to not read attachments on startup. I’ve extensively tested this, not only with regular attachments, but also with outline items and attachments in annotations. This PR builds on mozillaGH-21234. It’s an alternative to the naïve mozillaGH-20732. Closes mozillaGH-20049.
wooorm
added a commit
to wooorm/pdf.js
that referenced
this pull request
Jun 3, 2026
Normally entire PDFs are encrypted (or not). But it is also possible to only encrypt attachments. It is then also possible to *only* prompt for a password when the user opens them. In the existing flow, prompting for passwords happens because things are decrypted. A specific error is thrown, caught, and the user is prompted. To keep this flow working, this PR changes to decrypting attachments on demand, instead of eagerly. This sounds logical: to not read attachments on startup. I’ve extensively tested this, not only with regular attachments, but also with outline items and attachments in annotations. This PR builds on mozillaGH-21234. It’s an alternative to the naïve mozillaGH-20732. Closes mozillaGH-20049.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is related to GH-20732, which is about
AuthEvent(to delay promting for a password), but instead adds the actual support for encrypted attachments.“Encrypted attachments” means that the main things are plain text. Note that some PDF viewers, like Preview/QuickLook/Safari or Chrome, do not support attachments at all.
Also note that the file checked into the tests is the same as
output-no-auth-event.pdfreferenced in#20139 (comment).
Closes GH-20139.