Repository navigation
fix(deps): resolve Dependabot security alerts - #591
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesPDF.js migration
WebTransport dependency update
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 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".
Summary
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— passedpnpm audit --json— 0 vulnerabilitiespnpm run build— passedpnpm run lint— passed with 0 errors (151 existing warnings)pnpm run format:check— passedmake verify-local-paths— passedgo test ./...ininternal/compat/zishang520-webtransport-go— passedglobalThis.Iteratorunavailable before import, PDF.js 6.2.108 installed its compatibility layer, opened a real PDF, loaded the scoped layer stylesheet, extractedDummy PDF file, and closed without an exceptionRefreshed 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 existingNotificationsAdminSettings.test.tsx:119assertion for/Silo renews automatically/. The exact failure reproduces on currentmainand 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
PDFDocumentProxytoPDFDocumentLoadingTask, 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 bothenableScripting: falseandisEvalSupported: 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
Summary by CodeRabbit
Bug Fixes
Tests
Chores