diff options
| -rw-r--r-- | meta-oe/recipes-support/emacs/emacs_29.1.bb | 1 | ||||
| -rw-r--r-- | meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch | 60 |
2 files changed, 61 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/emacs/emacs_29.1.bb b/meta-oe/recipes-support/emacs/emacs_29.1.bb index 7d5b3cd3fb..f0666a41c4 100644 --- a/meta-oe/recipes-support/emacs/emacs_29.1.bb +++ b/meta-oe/recipes-support/emacs/emacs_29.1.bb | |||
| @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" | |||
| 7 | SRC_URI = "https://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.xz \ | 7 | SRC_URI = "https://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.xz \ |
| 8 | file://0001-org-macro-set-templates-Prevent-code-evaluation.patch \ | 8 | file://0001-org-macro-set-templates-Prevent-code-evaluation.patch \ |
| 9 | file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \ | 9 | file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \ |
| 10 | file://0001-org-latex-preview-Add-protection-when-untrusted-cont.patch \ | ||
| 10 | " | 11 | " |
| 11 | SRC_URI:append:class-target = " \ | 12 | SRC_URI:append:class-target = " \ |
| 12 | file://use-emacs-native-tools-for-cross-compiling.patch \ | 13 | file://use-emacs-native-tools-for-cross-compiling.patch \ |
diff --git a/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch b/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch new file mode 100644 index 0000000000..085bc31c17 --- /dev/null +++ b/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | From c5cc03c196306372e53700553e0fb5135f6105e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ihor Radchenko <yantar92@posteo.net> | ||
| 3 | Date: Tue, 20 Feb 2024 12:47:24 +0300 | ||
| 4 | Subject: [PATCH] org-latex-preview: Add protection when `untrusted-content' is | ||
| 5 | non-nil | ||
| 6 | |||
| 7 | * lisp/org/org.el (org--latex-preview-when-risky): New variable | ||
| 8 | controlling how to handle LaTeX previews in Org files from untrusted | ||
| 9 | origin. | ||
| 10 | (org-latex-preview): Consult `org--latex-preview-when-risky' before | ||
| 11 | generating previews. | ||
| 12 | |||
| 13 | This patch adds a layer of protection when LaTeX preview is requested | ||
| 14 | for an email attachment, where `untrusted-content' is set to non-nil. | ||
| 15 | |||
| 16 | CVE: CVE-2024-30204 | ||
| 17 | |||
| 18 | Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=6f9ea396f49cbe38c2173e0a72ba6af3e03b271c] | ||
| 19 | Signed-off-by: Gyorgy Sarvari | ||
| 20 | --- | ||
| 21 | lisp/org/org.el | 19 +++++++++++++++++++ | ||
| 22 | 1 file changed, 19 insertions(+) | ||
| 23 | |||
| 24 | diff --git a/lisp/org/org.el b/lisp/org/org.el | ||
| 25 | index d3e14fe..ab58978 100644 | ||
| 26 | --- a/lisp/org/org.el | ||
| 27 | +++ b/lisp/org/org.el | ||
| 28 | @@ -1140,6 +1140,24 @@ the following lines anywhere in the buffer: | ||
| 29 | :package-version '(Org . "8.0") | ||
| 30 | :type 'boolean) | ||
| 31 | |||
| 32 | +(defvar untrusted-content) ; defined in files.el | ||
| 33 | +(defvar org--latex-preview-when-risky nil | ||
| 34 | + "If non-nil, enable LaTeX preview in Org buffers from unsafe source. | ||
| 35 | + | ||
| 36 | +Some specially designed LaTeX code may generate huge pdf or log files | ||
| 37 | +that may exhaust disk space. | ||
| 38 | + | ||
| 39 | +This variable controls how to handle LaTeX preview when rendering LaTeX | ||
| 40 | +fragments that originate from incoming email messages. It has no effect | ||
| 41 | +when Org mode is unable to determine the origin of the Org buffer. | ||
| 42 | + | ||
| 43 | +An Org buffer is considered to be from unsafe source when the | ||
| 44 | +variable `untrusted-content' has a non-nil value in the buffer. | ||
| 45 | + | ||
| 46 | +If this variable is non-nil, LaTeX previews are rendered unconditionally. | ||
| 47 | + | ||
| 48 | +This variable may be renamed or changed in the future.") | ||
| 49 | + | ||
| 50 | (defcustom org-insert-mode-line-in-empty-file nil | ||
| 51 | "Non-nil means insert the first line setting Org mode in empty files. | ||
| 52 | When the function `org-mode' is called interactively in an empty file, this | ||
| 53 | @@ -15687,6 +15705,7 @@ fragments in the buffer." | ||
| 54 | (interactive "P") | ||
| 55 | (cond | ||
| 56 | ((not (display-graphic-p)) nil) | ||
| 57 | + ((and untrusted-content (not org--latex-preview-when-risky)) nil) | ||
| 58 | ;; Clear whole buffer. | ||
| 59 | ((equal arg '(64)) | ||
| 60 | (org-clear-latex-preview (point-min) (point-max)) | ||
