Repository navigation
fix(web): keep Word preview text dark and opaque in dark mode - #804
Conversation
There was a problem hiding this comment.
Caution
This PR breaks PDF previews. The app now hands the previewer a 6.2.108 worker while the previewer bundles its own pdf.js 6.1.200, and pdf.js aborts every document load on that version mismatch.
Approach: the Word dark-mode CSS fix is sound, but the dependency bump targets the wrong copy of pdf.js — the one that renders previews lives inside the previewer's bundle and stays at 6.1.200, so the bump both fails to clear the advisory and breaks the PDF path.
Reviewed changes
- Dependency bump —
pdfjs-dist6.1.200 → 6.2.108 inapps/web/package.jsonandapps/web/bun.lock; the lockfile now resolves a second, nested copy at 6.1.200 for the previewer. - Docx text color — new
.rfp-root .rfp-docx-container { color: #171717 }override inapps/web/src/index.css; verified it reaches both docx renderers (the.rfp-legacy-doc-paperlayout and the paginated inline-white pages) and matches the previewer's own light-theme foreground (rgb(23 23 23 / .9)).
⚠️ The vulnerable pdf.js is bundled inside the previewer, so this bump cannot clear the advisory
@eternalheart/[email protected] ships its own pdf.js 6.1.200 inside lib/chunks/ and that is the copy that parses and renders PDFs; the top-level pdfjs-dist is only imported for its worker file. Bumping the direct dependency therefore leaves the flagged version in the lockfile (the new nested @eternalheart/react-file-preview/pdfjs-dist entry at apps/web/bun.lock:2410), which is what the Dependabot alert tracks. The latest published previewer is still 1.6.13 with [email protected], so there is no upstream upgrade that fixes this today.
Technical details
# The advisory is not cleared by bumping the app's direct dependency
## Affected sites
- `apps/web/bun.lock:2410` — new nested `[email protected]` resolution under `@eternalheart/react-file-preview`; the vulnerable version stays in the lockfile.
- `apps/web/src/components/files/file-preview.tsx:9` — the app's only use of the top-level `pdfjs-dist` is the worker URL.
- `@eternalheart/[email protected]/lib/chunks/index-Bb9eOVP-.mjs` — bundled pdf.js API, sends `apiVersion: "6.1.200"`.
- `docs/product/file-management.md:85` — states "`pdfjs-dist` is pinned to the library's version"; stale after this change.
## Required outcome
- The PR must not claim to resolve the advisory while a vulnerable copy remains resolved in `apps/web/bun.lock`.
- `docs/product/file-management.md:85` must describe the new arrangement if the pin is intentionally broken.
## Suggested approach (optional)
- Keep the top-level `pdfjs-dist` at the version the previewer bundles until an upstream release bundles >= 6.2.108, and track that upgrade; or
- render PDFs with the app's own pdf.js 6.2.108 (own viewer component) and drop the previewer's PDF path; or
- vendor a matching worker file if a worker-only upgrade is genuinely sufficient for the advisory.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
ac940c0 to
17b6b91
Compare
There was a problem hiding this comment.
Caution
The new overrides entry does not fix the PDF breakage. It changes the installed pdfjs-dist copy, but the pdf.js that parses PDFs is inlined inside @eternalheart/[email protected] at 6.1.200, so the 6.2.108 worker still rejects its apiVersion: "6.1.200" and every PDF preview still fails.
Approach: the commit tries to align API and worker by collapsing pdfjs-dist to one resolved version, but the API side is not resolved from node_modules — it is baked into the previewer's lib/chunks/ — so the override cannot reach it, and it removes the lockfile evidence of the vulnerable version without removing the vulnerable code.
Reviewed changes
- Collapsed
pdfjs-distwith a Bun override — added"overrides": { "pdfjs-dist": "6.2.108" }toapps/web/package.jsonand dropped the nested@eternalheart/react-file-preview/pdfjs-dist6.1.200 resolution fromapps/web/bun.lock.
🚨 overrides cannot reach the previewer's inlined pdf.js
Bun overrides only rewrites the resolved node_modules copy. @eternalheart/[email protected] inlines its own pdf.js 6.1.200 in lib/chunks/index-Bb9eOVP-.mjs and has no runtime import of pdfjs-dist, so the app still serves that 6.1.200 API a 6.2.108 worker from file-preview.tsx:9, and the worker throws on every document load. The same override also removes the nested 6.1.200 lockfile entry without removing the vulnerable code, so Dependabot alert 147 can clear while the vulnerability remains.
Technical details
# The override targets the wrong copy of pdf.js
## Affected sites
- `apps/web/package.json:86` — the override only affects the installed `pdfjs-dist` copy, not code inlined in a dependency.
- `apps/web/src/components/files/file-preview.tsx:9,33` — serves the 6.2.108 worker to the previewer via `configurePdfjs({ workerSrc })`.
- `@eternalheart/[email protected]/lib/chunks/index-Bb9eOVP-.mjs` — inlined pdf.js API; sends `apiVersion: "6.1.200"` and sets `GlobalWorkerOptions.workerSrc` on that inlined module.
- `@eternalheart/[email protected]/lib/chunks/pdf.worker-6kySV6rJ.mjs` — bundled 6.1.200 worker, unused once the app sets `workerSrc`.
- `apps/web/bun.lock:263` — the previewer entry still declares `"pdfjs-dist": "6.1.200"`; the nested resolution was removed by the override.
## Required outcome
- The served worker version must match the previewer's inlined `apiVersion` (6.1.200 today), or PDFs must be rendered by a pdf.js instance the app controls end to end.
- The advisory must not be treated as resolved while the previewer ships vulnerable 6.1.200 code.
## Suggested approach (optional)
- Keep the worker at `[email protected]` until a previewer release bundles >= 6.2.108; or
- render PDFs with the app's own `[email protected]` and stop using the previewer's PDF path; or
- patch the previewer's inlined chunk and worker via `bun patch` (fragile, but keeps the previewer UI).deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Approach: the PR is now scoped to the Word dark-mode fix only; the pdfjs-dist bump and the overrides block were reverted, so the worker and the previewer's inlined pdf.js stay on 6.1.200 and PDF previews are unaffected.
Reviewed changes
- Reverted the pdfjs-dist bump and override —
apps/web/package.jsonandapps/web/bun.lockare back to their base state (pdfjs-dist6.1.200, nooverrides), removing both the worker/API version mismatch and the lockfile masking of the advisory. - Retained the docx text-color rule —
.rfp-root .rfp-docx-container { color: #171717 }is unchanged from the version already verified against both docx renderers, where the white paper would otherwise inherit the previewer's translucent-white dark-mode foreground.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Summary
.rfp-docx-container; colors set by the document itself still apply.Test plan