Skip to content

fix: make the vendored pdf.js auditable - #360

Merged
oc-tmueller merged 1 commit into
masterfrom
fix/document-vendored-pdfjs
Sep 9, 2026
Merged

oc-tmueller merged 1 commit into
masterfrom
fix/document-vendored-pdfjs

Conversation

@oc-tmueller

Copy link
Copy Markdown
Contributor

Dependency audit for this app, a precondition for the re-release tracked in owncloud/core#41824.

What I found

js/vendor/pdfjs/ holds a built and locally patched copy of PDF.js. Three things made it unauditable:

  1. pdfjsVersion reads 2.10.0, but the copy is patched. CVE-2024-4367 was backported in commit 3358e60 (fix: mitigate CVE-2024-4367 FontMatrix code injection in pdf viewer #351) and recorded nowhere outside the patched files. So the version string overstates the risk, while nothing revealed the real patch level. That is the worst of both worlds: a scanner keyed on the version cries wolf, and a human auditing by version cannot tell what is actually fixed.
  2. No scanner could see it at all. The directory carries no manifest, so pdf.js never appeared in any inventory of what this app ships. Bower has been unmaintained since 2017 and Dependabot has never supported it, so nothing watched pdfjs: ~2.10.x either.
  3. .gitignore was hiding the directory. The composer rule vendor/ was unanchored, so it also matched js/vendor/. New files there were silently ignored unless added with git add -f.

Audit result: nothing is unpatched

Every published pdfjs-dist advisory, checked against 2.10.0 (GitHub Advisory Database, 2026-09-09):

advisory affected range applies?
CVE-2024-4367 <= 4.1.392 yes — backported in 3358e60
CVE-2026-16633 >= 5.6.83, < 6.2.108 no
CVE-2018-5158 >= 2.0.0, < 2.0.550, < 1.10.100 no

So this needs no security work — only a record and some visibility.

Changes

  • js/vendor/pdfjs/PATCHES.md — upstream version and build id, the applied backport with its commit, the audit table above, and how to regenerate. It states plainly that the version string cannot be trusted on its own.
  • js/vendor/pdfjs/package.json — so scanners and SBOM tooling can inventory the library.
  • .trivyignore — accepts exactly CVE-2024-4367, with the justification and a pointer to PATCHES.md.
  • .gitignore — anchor the composer rule to /vendor/.
  • remove root dependabot.yml — GitHub only reads .github/dependabot.yml; the two disagreed on schedule and PR limit, so the root file was dead config.

On the manifest and the ignore file

Adding the manifest deliberately trades one false positive for real visibility. Verified with Trivy, mirroring how reusable-workflows/.github/workflows/trivy.yml invokes it — working directory = repository root, scan target = the built dist tree:

result
before pdf.js not detected at all; nothing in the report
after, no ignore file detected as pdfjs-dist 2.10.0, CVE-2024-4367 HIGH, exit 1 — would fail security-scan
after, with .trivyignore detected and listed with 0 vulnerabilities, exit 0

Being listed with a documented, reviewable exception is worth more than not being listed. The ignore entry is scoped to the single advisory, not the package or the severity, so any new pdf.js advisory still fails the scan.

Not in this PR

The version bump to 1.1.2 is separate, so this can be reviewed on its merits and the release timed independently.

Upgrading pdf.js 2.10 → 5.x is deferred and worth tracking on its own: it is a breaking change to the API, the viewer layout and the build variants, and it would replace bower with the prebuilt pdfjs-dist npm package — which is also what would finally let Dependabot watch this. PATCHES.md records that as the durable fix. It does not belong in a patch release, since it changes what make dist consumes.

🤖 Generated with Claude Code

js/vendor/pdfjs holds a built, locally patched copy of PDF.js 2.10.0. Its
version string still reads 2.10.0, and the CVE-2024-4367 backport applied
in commit 3358e60 was recorded nowhere outside the patched files - so the
version string overstates the risk while nothing revealed the real patch
level. Bower is unmaintained and Dependabot has never supported it, and
the copy carried no manifest, so no scanner listed pdf.js at all.

Add js/vendor/pdfjs/PATCHES.md recording the upstream version and build
id, the applied backport with its commit, and the audit of every
published pdfjs-dist advisory against 2.10.0: CVE-2024-4367 applies and
is backported; CVE-2026-16633 (>= 5.6.83) and CVE-2018-5158 (< 2.0.550)
do not. Nothing is unpatched.

Add js/vendor/pdfjs/package.json so scanners and SBOM tooling can see the
library. Verified with Trivy: the dist tree now reports
js/vendor/pdfjs/package.json as pdfjs-dist 2.10.0, where previously
nothing was detected. The cost is one false positive - a scanner keyed on
the version reports the backported CVE-2024-4367 - so .trivyignore
accepts exactly that advisory and points at PATCHES.md. Verified against
the reusable trivy workflow's invocation (working directory = repository
root, scan target = dist tree): exit 0 with the ignore file, exit 1
without it.

Anchor the composer `vendor/` gitignore rule to the project root. Left
unanchored it also matched js/vendor/, so these new files were ignored
until added with -f; commit d944e5b anchored the other root-only rules
but missed this one. Root vendor/ stays ignored.

Remove the inert dependabot.yml from the repository root. GitHub only
reads .github/dependabot.yml, and the two disagreed on schedule and PR
limit.

Refs: owncloud/core#41824

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@oc-tmueller
oc-tmueller requested a review from a team as a code owner September 9, 2026 12:36
@CLAassistant

CLAassistant commented Sep 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@oc-tmueller oc-tmueller mentioned this pull request Sep 9, 2026
@oc-tmueller
oc-tmueller merged commit 504d33c into master Sep 9, 2026
13 checks passed
@oc-tmueller
oc-tmueller deleted the fix/document-vendored-pdfjs branch September 9, 2026 13:32
@oc-tmueller oc-tmueller mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants