PDF.js viewer pages need origin-aware inventory, not a library version claim
PDF.js viewer pages need origin-aware inventory, not a library version claim PDF.js is often embedded as a viewer in another application. The page may show a PDF title, a toolbar, or a document URL without identifying the JavaScript library that renders it. A public count of viewer pages can help a document-platform owner find the right assets, but the origin and embedding context matter more…
PDF.js viewer pages require an inventory based on origin, rather than relying on the library version itself. This application often serves as a viewer in other programs, displaying PDF titles, toolbars, or document URLs without explicitly identifying the JavaScript library responsible for rendering. A public tally of viewer pages can assist document-platform owners in locating the appropriate assets, but the crucial factors are the origin and embedding context, not just the library's name.
By examining pages on November 23, 2026, analysts found zero matches for "app='PDF.js'", 431 instances where the title equaled "PDF.js", and 2,530 occurrences where the body content was "PDF.js viewer". These findings represent index matches, not confirmed instances of vulnerable viewers. The security boundary is defined by the browser, making the PDF.js FAQ's statement about the viewer's permissions particularly relevant.
When served alongside an authenticated application, the viewer inherits the browser's same-origin policy and operates with the permissions granted to ordinary JavaScript. Therefore, a viewer embedded within an authenticated application shares the same security model, assuming the deployer has not taken steps to segregate it.
To enhance security, it is essential for teams to understand and adjust current configurations, focusing on elements like eval-based execution support, viewer origin settings, message handlers, and any wrappers that accept document URLs. Properly identifying the viewer's origin, parent-frame allowlist, Content Security Policy (CSP), package version, and document source is crucial.
By recording these details, owners can better assess the risks associated with each viewer page, whether it serves as a public documentation portal, a customer file link, or an internal application that inadvertently exposed through a proxy.
For owned viewers, it is recommended to document the origin, parent-frame allowlist, CSP, package version, and document source. Testing should involve attempting to call dangerous URLs or execute code that reaches the parent application, followed by checking whether the iframe sandbox and browser policies effectively block these attempts.
To operate the viewer safely, it is advisable to pin the package and worker build together, review advisories before updating, serve untrusted documents from a separate origin, keep cookies and application storage out of that origin, sanitize document titles and links, and monitor anomalous document loads and viewer-origin errors.
The 431 title matches found in the investigation serve as a discovery lead, indicating the need for a comprehensive inventory that links each viewer page to its owner, the embedded application, document source, and browser boundary. This mapping offers a more durable solution than merely counting pages that happen to include the product name.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to