fix: harden PDF.js for strict CSP - #115
Merged
Merged
Conversation
vitormattos
force-pushed
the
fix/pdfjs-strict-csp
branch
from
September 18, 2026 15:47
9155099 to
811ad26
Compare
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
vitormattos
force-pushed
the
fix/pdfjs-strict-csp
branch
from
September 18, 2026 16:05
bcc33aa to
87aaed9
Compare
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.
What changed
isEvalSupported: falseenableScripting: falseunsafe-evalWhy
pdf-elementsis embedded by applications such as LibreSign that run with a restrictive Content Security Policy. PDF rendering does not need dynamic evaluation or embedded PDF JavaScript for our use case, so these features should stay disabled by default.This change was prepared while investigating CSP errors in LibreSign on Nextcloud. It does not assume that
pdf-elementsis the cause of that separate rendering issue.Tests
The unit tests verify that safe PDF.js options are always passed to
getDocument(), including when a caller attempts to enable them.The Playwright test loads the demo with a CSP that does not allow
unsafe-eval, renders a PDF, and checks for eval-related CSP/page errors.