-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dependency pdfjs-dist to v4 [SECURITY] #5462
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,13 +205,10 @@ export class PdfPlayer { | |
const downloadHref = apiClient.getItemDownloadUrl(item.Id); | ||
|
||
this.bindEvents(); | ||
GlobalWorkerOptions.workerSrc = appRouter.baseUrl() + '/libraries/pdf.worker.js'; | ||
GlobalWorkerOptions.workerSrc = appRouter.baseUrl() + '/libraries/pdf.worker.min.mjs'; | ||
|
||
const downloadTask = getDocument({ | ||
url: downloadHref, | ||
// Disable for PDF.js XSS vulnerability | ||
// https://github.com/mozilla/pdf.js/security/advisories/GHSA-wgrm-67xf-hhpq | ||
isEvalSupported: false | ||
url: downloadHref | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This workaround is no longer required. |
||
}); | ||
return downloadTask.promise.then(book => { | ||
if (this.cancellationToken) return; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ const CopyPlugin = require('copy-webpack-plugin'); | |
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const { TransformAsyncModulesPlugin } = require('transform-async-modules-webpack-plugin'); | ||
const { DefinePlugin, IgnorePlugin } = require('webpack'); | ||
const packageJson = require('./package.json'); | ||
|
||
|
@@ -15,7 +16,7 @@ const Assets = [ | |
'@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.js', | ||
'@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.wasm', | ||
'@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker-legacy.js', | ||
'pdfjs-dist/build/pdf.worker.js' | ||
'pdfjs-dist/build/pdf.worker.min.mjs' | ||
]; | ||
|
||
const DEV_MODE = process.env.NODE_ENV !== 'production'; | ||
|
@@ -109,7 +110,9 @@ const config = { | |
typescript: { | ||
configFile: path.resolve(__dirname, 'tsconfig.json') | ||
} | ||
}) | ||
}), | ||
// Transform any modules using top-level await (pdf.js) | ||
new TransformAsyncModulesPlugin() | ||
], | ||
output: { | ||
filename: pathData => ( | ||
|
@@ -205,6 +208,7 @@ const config = { | |
path.resolve(__dirname, 'node_modules/markdown-it'), | ||
path.resolve(__dirname, 'node_modules/material-react-table'), | ||
path.resolve(__dirname, 'node_modules/mdurl'), | ||
path.resolve(__dirname, 'node_modules/pdfjs-dist'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't notice any issues moving this back into our standard babel build, but is there anything specific that needs tested here @dmitrylyzo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh, I don't remember. 😅 At the moment, webOS 1.2 fails with case 2:
_context5.next = 4;
return import(/*webpackIgnore: true*/_this37.workerSrc);
case 4: I'm using Anyway, |
||
path.resolve(__dirname, 'node_modules/punycode'), | ||
path.resolve(__dirname, 'node_modules/react-blurhash'), | ||
path.resolve(__dirname, 'node_modules/react-lazy-load-image-component'), | ||
|
@@ -268,7 +272,6 @@ const config = { | |
{ | ||
test: /\.js$/, | ||
include: [ | ||
path.resolve(__dirname, 'node_modules/pdfjs-dist'), | ||
path.resolve(__dirname, 'node_modules/xmldom') | ||
], | ||
use: [{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file includes dynamic imports that are only used in
nodejs
environments, so it should be safe to ignore.