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

[Bug]: This PDF file contains JavaScript. If you want to view it, please download and open it in your local PDF viewer. #16955

Open
abernardgalilee opened this issue Apr 17, 2024 · 3 comments

Comments

@abernardgalilee
Copy link

Pimcore version

11.2.2

Steps to reproduce

Pdf with Javascript :
PDFS_CopyPastListEntries.pdf
PrintReady Pdf without Javascript can be downloaded here : http://www.folionet.fr/galilee/Arnaud/PERM_VOYAGES_PLV_GAMME_AFRICAN_COLORS_V1.pdf

Actual Behavior

The PrintReadyPdf file has clearly no Javascript at all and a pro software like Pitstop does not find any malicious javascript in the PdfFile.
I think the streming of the PDF is not good enough.
Javascript can occur in a Pdf when you have forms such as :
Capture d’écran 2024-04-17 à 17 44 23

Expected Behavior

The PrintReadyPdf should not show the warning while the other Pdf should.

@kingjia90
Copy link
Contributor

I guess then there is a false positive due to this
image

if (str_contains($chunk, '/JS') || str_contains($chunk, '/JavaScript')) {

@abernardgalilee
Copy link
Author

Yes sure you are right.
But the algorithm is simply wrong. This is not what should be done in order to detect Javascript in PDFs....

@kingjia90
Copy link
Contributor

kingjia90 commented Apr 18, 2024

Yes, i believe there were no any other better solution for that at the time, in the beginning it was even intended to be "sanitizing" instead of just scanning #14998 (comment)
Maybe there are some better tools/idea now

It would probably make more sense to have it like a soft warning (like old school outlook) when the /JS is detected and not completely block it, in addition should have a button "Looks safe" to proceed the preview as usual, as the uploaded files should be trusted source or sanitized at origin.
image

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

No branches or pull requests

2 participants