branch: elpa/flycheck
commit 0707e3426edf8dd9529bd8ad1058eb0b3add4507
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Say where trust gating applies in terms of trusted-content-p
The compat library defines `trusted-content-p' on Emacs 28 and 29, and
plenty of packages pull compat in, so the `emacs-lisp' checker is
trust-gated there as well. The docs said Emacs 30+ only.
---
doc/languages.rst | 8 +++++---
flycheck.el | 10 ++++++----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/doc/languages.rst b/doc/languages.rst
index 3f21707ed5..8e2582ebfc 100644
--- a/doc/languages.rst
+++ b/doc/languages.rst
@@ -365,9 +365,11 @@ to view the docstring of the syntax checker. Likewise,
you may use
Check syntax with the built-in byte compiler.
- On Emacs 30+, this checker is only enabled for files marked as
- trusted via ``trusted-content`` (see :infonode:`(emacs)Safe File
- Variables`), to mitigate CVE-2024-53920. Byte-compilation involves
+ On Emacs 30+, and on older Emacs with the ``compat`` library (which
+ many packages depend on), this checker is only enabled for files
+ marked as trusted via ``trusted-content`` (see
+ :infonode:`(emacs)Safe File Variables`), to mitigate
+ CVE-2024-53920. Byte-compilation involves
macro expansion which can execute arbitrary code, so untrusted files
must not be byte-compiled. To use this checker, add your project
directories to ``trusted-content``. The ``emacs-lisp-checkdoc``
diff --git a/flycheck.el b/flycheck.el
index b3f9295a0a..662367b703 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -94,7 +94,7 @@
;; Tell the byte compiler about autoloaded functions from packages
(declare-function org-lint "org-lint" (&optional arg))
-;; Emacs 30 and newer; guarded with `fboundp' where it is called
+;; Emacs 30 and newer, or compat; guarded with `fboundp' where it is called
(declare-function trusted-content-p "files" ())
(declare-function xref-push-marker-stack "xref" (&optional m))
@@ -15976,7 +15976,8 @@ This variable has no effect, if
(defun flycheck--emacs-lisp-byte-compile-enabled-p ()
"Check whether to enable the Emacs Lisp byte compiler checker.
-On Emacs 30+, the checker is only enabled for trusted files, to
+Wherever `trusted-content-p' exists (Emacs 30+, or older Emacs with
+the compat library), the checker is only enabled for trusted files, to
mitigate CVE-2024-53920: byte-compilation involves macro expansion
which can execute arbitrary code. Customize `trusted-content' to
mark files or directories as trusted.
@@ -16037,8 +16038,9 @@ doesn't."
(flycheck-define-checker emacs-lisp
"An Emacs Lisp syntax checker using the Emacs Lisp Byte compiler.
-On Emacs 30+, this checker is only enabled for files the user has
-marked as trusted via the `trusted-content' variable, to mitigate
+On Emacs 30+, and on older Emacs with the compat library, this checker
+is only enabled for files the user has marked as trusted via the
+`trusted-content' variable, to mitigate
CVE-2024-53920 (byte-compilation involves macro expansion which can
execute arbitrary code).