elisp-mode.el: Disable Flymake byte-compile backend in untrusted files
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 10 Dec 2024 21:26:31 +0000 (16:26 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 14 Dec 2024 14:48:36 +0000 (09:48 -0500)
commitb5158bd191422e46273c4d9412f2bf097e2da2e0
tree1872e489d63482f512a361d1ec5ec814e1ee59b3
parent6942599dbb24c1a469e3d3708df83692b49e4af8
elisp-mode.el: Disable Flymake byte-compile backend in untrusted files

To address serious security issues (CVE-2024-53920), disable
`elisp-flymake-byte-compile` except in those files explicitly
specified as "trusted".

For that introduce a new custom var `trusted-files` and new
function `trusted-content-p`.

While at it, similarly skip the implicit macroexpansion done during
completion if the current file is not trusted.

* lisp/files.el (trusted-files): New variable.
(trusted-content-p): New function.

* lisp/progmodes/elisp-mode.el (elisp--safe-macroexpand-all):
New function, extracted from `elisp--local-variables`.
Use `trusted-content-p`.
(elisp--local-variables): Use it.
(elisp-flymake-byte-compile): Disable according to `trusted-content-p`.
etc/NEWS
lisp/files.el
lisp/progmodes/elisp-mode.el