Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(files): downgrade PDF.js to v5.6.205 and allow viewer WASM in CSP

johaven5a868dfd5bb5
diff --git a/backend/src/app.constants.ts b/backend/src/app.constants.ts
index 92cf253b..a0af6789 100644
--- a/backend/src/app.constants.ts
+++ b/backend/src/app.constants.ts
@@ -2,11 +2,11 @@ import { loadVersion } from './app.functions'
export const VERSION = loadVersion()
export const USER_AGENT = `sync-in-server/${VERSION}`
-export const CONTENT_SECURITY_POLICY = (onlyOfficeServer: string, collaboraServer: string) => ({
+export const CONTENT_SECURITY_POLICY = (xOfficeServer: string, collaboraServer: string) => ({
useDefaults: false,
directives: {
- defaultSrc: ["'self'", onlyOfficeServer || '', collaboraServer || ''],
- scriptSrc: ["'self'", "'unsafe-inline'", onlyOfficeServer || ''],
+ defaultSrc: ["'self'", xOfficeServer || '', collaboraServer || ''],
+ scriptSrc: ["'self'", "'unsafe-inline'", "'wasm-unsafe-eval'", xOfficeServer || ''],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", 'data:'],
fontSrc: ["'self'"]
diff --git a/frontend/scripts/pdfjs.mjs b/frontend/scripts/pdfjs.mjs
index ee4d0638..473ba7c1 100644
--- a/frontend/scripts/pdfjs.mjs
+++ b/frontend/scripts/pdfjs.mjs
@@ -9,7 +9,8 @@ import { Uint8ArrayReader, Uint8ArrayWriter, ZipReader } from '@zip.js/zip.js/in
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
-const pdfjsVersion = 'v5.7.284'
+// stable: v5.4.394
+const pdfjsVersion = 'v5.6.205'
const pdfjsDownloadAsset = `pdfjs-${pdfjsVersion.slice(1)}-dist.zip`
const pdfjsReleaseURL = `https://api.github.com/repos/mozilla/pdf.js/releases/tags/${pdfjsVersion}`
let pdfjsDownloadURL