Skip to content

fix(deps): resolve Dependabot security alerts - #591

Merged
Quick104 merged 3 commits into
mainfrom
fix/dependabot-security-alerts
Aug 11, 2026
Merged

Quick104 merged 3 commits into
mainfrom
fix/dependabot-security-alerts

Conversation

@Quick104

@Quick104 Quick104 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • update every dependency currently covered by the repository's 15 open Dependabot alerts
  • upgrade PDF.js from 5.7.284 to 6.2.108 and synchronize its checked-in legacy runtime and worker plus its Wasm assets
  • extract only PDF.js's text/image/annotation layer styles for Silo's embedded reader instead of shipping the 6,347-line viewer UI stylesheet
  • update the vendored Foliate PDF adapter for PDF.js 6, including v6 loading-task cleanup, while explicitly disabling embedded PDF scripting and dynamic evaluation
  • raise the PostCSS, Undici, js-yaml, and brace-expansion overrides to patched releases
  • update the nested WebTransport module from 0.10.0 to 0.11.1
  • add focused regressions for the PDF security boundary, lifecycle cleanup, and stylesheet scope

Security maintenance: Dependabot alerts

Why

The web lockfile and nested compatibility module retained versions affected by public advisories. Most JavaScript findings are build/test-only transitive dependencies, but PDF.js is part of the shipped ebook reader and processes user-provided PDF content. The root Go graph already selected a safe WebTransport version, but the independently testable nested module still declared the vulnerable version.

The PDF.js upgrade is a major-version change, so its checked-in browser assets and adapter were upgraded together. PDF.js 6 publishes a combined viewer stylesheet instead of the v5 layer-specific files, but Silo does not use PDF.js's viewer shell. The checked-in 640-line stylesheet is the unchanged upstream 6.2.108 text, text-image, and annotation layer section; toolbar, sidebar, dialog, editor, and XFA styles are excluded.

User impact

No API, UI, or intended reader behavior changes. PDF ebooks continue to open and close through the existing reader, while vulnerable dependency versions and unused viewer UI styles are removed.

Validation

  • pnpm install --frozen-lockfile — passed
  • pnpm audit --json — 0 vulnerabilities
  • focused reader Vitest suite — 32 tests passed
  • pnpm run build — passed
  • pnpm run lint — passed with 0 errors (151 existing warnings)
  • pnpm run format:check — passed
  • make verify-local-paths — passed
  • nested go test ./... in internal/compat/zishang520-webtransport-go — passed
  • browser smoke test — with globalThis.Iterator unavailable before import, PDF.js 6.2.108 installed its compatibility layer, opened a real PDF, loaded the scoped layer stylesheet, extracted Dummy PDF file, and closed without an exception

Refreshed CI at 242ce19b9: Go and Docs hygiene passed. Web passed install, lint, formatting, typecheck/build, and all reader tests; its test step failed only the existing NotificationsAdminSettings.test.tsx:119 assertion for /Silo renews automatically/. The exact failure reproduces on current main and is unrelated to this diff.

Risk and adversarial review

The primary risk is the PDF.js major upgrade. Adversarial review found five compatibility/security edges: the vendored Foliate manifest could independently resolve PDF.js 5, PDF.js 6 consolidates the two layer stylesheets, the rendering API now prefers the canvas object, document destruction moved from PDFDocumentProxy to PDFDocumentLoadingTask, and disabling eval alone does not explicitly disable embedded PDF scripting. The patch pins both manifests to 6.2.108; synchronizes the official legacy runtime and worker plus the Wasm assets byte-for-byte from that package; keeps only the version-tagged upstream layer CSS Silo uses; adapts the render and cleanup calls; and sets both enableScripting: false and isEvalSupported: false. A fresh audit also exposed newer js-yaml and brace-expansion advisories, so the overrides use the newer patched releases rather than only the initial alert minimums.

AI Disclosure

  • Tool(s): Codex
  • Model(s): gpt-5.6-sol
  • Involvement: fully AI-generated under maintainer direction
  • Adversarial review: reviewed the complete dependency and vendored-asset diff, identified the PDF.js compatibility/security edges described above, resolved them, and repeated focused, build, audit, and browser validation after rebasing onto current main

Summary by CodeRabbit

  • Bug Fixes

    • Improved PDF rendering compatibility with the latest PDF.js release.
    • Disabled PDF scripting for enhanced security.
    • Updated security-related package overrides to patched versions.
  • Tests

    • Added coverage verifying that PDF scripting and evaluated code remain disabled.
  • Chores

    • Updated WebTransport and PDF.js dependencies.
    • Consolidated PDF viewer styling and refreshed bundled viewer assets.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR upgrades PDF.js to v6.2.108, updates rendering to the direct canvas API, consolidates viewer styles, disables PDF scripting and evaluated code, refreshes generated assets, and updates WebTransport.

Changes

PDF.js migration

Layer / File(s) Summary
PDF.js dependency and security settings
web/package.json, web/vendor/foliate-js/package.json, web/vendor/foliate-js/pdf.js, web/src/reader/PdfSecurity.test.ts
PDF.js dependencies and security overrides were updated. PDF loading disables scripting and evaluated code. Tests verify both options.
Rendering and viewer asset migration
web/vendor/foliate-js/pdf.js, web/public/vendor/pdfjs/annotation_layer_builder.css, web/public/vendor/pdfjs/text_layer_builder.css, web/public/vendor/pdfjs/wasm/quickjs-eval.js
Rendering uses direct canvases. Viewer styling uses pdf_viewer.css instead of separate layer stylesheets. The generated QuickJS bundle was regenerated.

WebTransport dependency update

Layer / File(s) Summary
WebTransport dependency version
internal/compat/zishang520-webtransport-go/go.mod
The WebTransport dependency was updated from v0.10.0 to v0.11.1.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FoliatePdf
  participant PDFjs
  participant HTMLCanvasElement
  participant PdfViewerCss
  FoliatePdf->>PDFjs: load document with scripting disabled
  FoliatePdf->>PDFjs: render page with canvas and viewport
  PDFjs->>HTMLCanvasElement: draw rendered page
  FoliatePdf->>PdfViewerCss: lazy-load consolidated viewer stylesheet
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the dependency updates that resolve the repository's Dependabot security alerts.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dependabot-security-alerts

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 marked this pull request as ready for review August 11, 2026 12:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9082b58c0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/public/vendor/pdfjs/pdf.min.mjs Resolved
Comment thread web/public/vendor/pdfjs/pdf_layers.css Resolved
@Quick104
Quick104 merged commit 6b70edf into main Aug 11, 2026
7 of 8 checks passed
@Quick104
Quick104 deleted the fix/dependabot-security-alerts branch August 11, 2026 13:59
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.

1 participant