PDF.js 中的 isEvalSupported 选项的安全隐患是什么

What are the security implications of the isEvalSupported option in PDF.js

PDF.js library has an option isEvalSupported,说明如下:

(optional) Determines if we can eval strings as JS. Primarily used to improve performance of font rendering, and when parsing PDF functions. The default value is true.

听起来对于不受信任的 PDF 来说不是个好主意。这对安全有影响吗?

潜在的可能性很小,但 PDF 只评估它自己生成的代码(不是随机的 JS 脚本)——所以理论上这不是一个真正的问题。 PDF.js 对这些用法进行了多次审查。请记住,这是一个 Web 应用程序,更糟糕的是它可以进行 XSS 攻击。

如果您在 PDF 查看器中提供不受信任的 PDF,并且托管在您的位置,则最好位于与您的主要应用程序不同的来源,www.example.org vs pdfviewer.example.org.