Skip to content

[fork-CI] [20.0][FIX] attachment_preview: PDFs in core pdf.js, ViewerJS same-origin only - #21

Open
dnplkndll wants to merge 2 commits into
20.0-mig-attachment_previewfrom
20.0-fix-attachment_preview-viewerjs
Open

dnplkndll wants to merge 2 commits into
20.0-mig-attachment_previewfrom
20.0-fix-attachment_preview-viewerjs

Conversation

@dnplkndll

Copy link
Copy Markdown

Stacked on #20. Two fixes on top of the 20.0 port:

  • Security: ViewerJS bundled pdf.js 1.1.114 (CVE-2018-5158, CVE-2024-4367) and loads any URL after #. Odoo serves it without a login, so a link alone ran script on the Odoo origin. PDFs now open in core's /web/static/lib/pdfjs viewer, which checks the file's origin. ViewerJS's pdf.js files are deleted, its PDF plugin entry is removed, and viewerjs_tweaks.js drops any document from another origin before ViewerJS's onload reads the hash.
  • Side panel: the panel loaded previewUrl, which 20.0's mail attachments don't carry, so its iframe opened undefined. Titles read attachment.filename, which 20.0 calls name.

Checked in a browser on the prod image:

  • the side panel renders a PDF in core's viewer and an ODT in ViewerJS;
  • ViewerJS/pdf.js returns 404;
  • index.html#https://… and #//… make no request off-origin;
  • the module's tests pass.

https://claude.ai/code/session_01BtuusZvm1PH6BFsRBeP3iH

ViewerJS bundled pdf.js 1.1.114 (CVE-2018-5158, CVE-2024-4367) and loads any
URL after the '#', so a link alone ran script on the Odoo origin. PDFs now go
to /web/static/lib/pdfjs, ViewerJS keeps ODF and refuses other origins.

Claude-Session: https://claude.ai/code/session_01BtuusZvm1PH6BFsRBeP3iH
The panel loads previewUrl, which 20.0's mail attachments do not carry, so its
iframe opened 'undefined'. Titles read attachment.filename, which 20.0 calls
name.

Claude-Session: https://claude.ai/code/session_01BtuusZvm1PH6BFsRBeP3iH
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