Skip to content

Security advisories in the shipped RCL frontend package (incl. pdfjs-dist) #51

Description

@deanleigh

Summary

Enabling Dependabot (#36) immediately surfaced advisories in src/UpDoc/wwwroot/App_Plugins/UpDoc — the shipped RCL's frontend package. This was missed during the #36 scoping, which audited only docs/.

npm audit in that directory reports 10 vulnerabilities (3 moderate, 7 high).

Why this is a separate issue from #36

#36 was correctly scoped as docs-only and cannot affect consuming projects. This can. It touches the package that ships to the live client project, so it needs the #40 release-safety baseline in place first.

The findings split into two very different risk categories

Build-time only (does not ship)

devDependencies — present in the repo, absent from the published package:

Package Severity Direct?
vite high direct
rollup high transitive
esbuild moderate transitive
postcss moderate transitive
minimatch high transitive
brace-expansion moderate transitive

Dependabot has already opened PRs for four of these: #46 (postcss), #47 (brace-expansion), #48 (minimatch), #49 (vite 5 → 6, major).

Risk to consumers: none — these never reach a consuming site. Risk is to the build itself, and vite 5 → 6 is a major bump that could break the bundle.

Runtime, and genuinely shipped

Package Severity Direct?
pdfjs-dist high direct dependency
canvas high transitive (via pdfjs-dist)
@mapbox/node-pre-gyp high transitive
tar high transitive

pdfjs-dist is a real dependency, not a dev dependency. Confirmed shipped: dist/pdf.worker.min.mjs is 1.3MB of built output, produced by the copy:pdfworker build step and included in the package. It is used for PDF thumbnail rendering in the backoffice.

This is the one that matters. It reaches consuming projects, including the live one.

Current: pdfjs-dist ^4.2.67. The advisory covers 3.0.279 - 4.7.76 via its canvas dependency.

Open questions

  • Is canvas actually reachable in the browser build? canvas is a Node-native module; pdf.js typically only uses it server-side, and the browser bundle may never touch that path. If so the practical severity drops sharply — but it needs confirming by inspecting the bundle, not assuming. Note the presence of __vite-browser-external-*.js in dist/, which suggests Vite is already externalising Node-only modules.
  • What does upgrading pdfjs-dist cost? Check whether v5 changes the worker API used by up-doc-pdf-thumbnail.element.ts and up-doc-pdf-picker.element.ts.
  • Take the Dependabot PRs as-is, or batch them? Bump vite from 5.4.21 to 6.4.3 in /src/UpDoc/wwwroot/App_Plugins/UpDoc in the npm_and_yarn group across 1 directory #49 (vite 5 → 6) is a major bump and should be verified against a full frontend build plus the E2E suite, not merged blind.

Done when

Sequencing

After #40 (release-safety baseline). This modifies the shipped package; the baseline is what demonstrates the import still works afterwards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions