From: Stefan Kangas <stefankangas@gmail.com>
To: john muhl <jm@pub.pink>, 75017@debbugs.gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>, Andrea Corallo <acorallo@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#75017: 31.0.50; Untrusted user lisp files
Date: Sun, 22 Dec 2024 02:47:45 +0000 [thread overview]
Message-ID: <CADwFkmk-W0ijE_4T0LMc3wqcp8BojQsb-+i998W6kZ2Hqnb2Wg@mail.gmail.com> (raw)
In-Reply-To: <87bjx43gp7.fsf@pub.pink>
john muhl <jm@pub.pink> writes:
> user-init-file is trusted by default but not other user files.
>
> C-xf ~/.emacs.d/early-init.el
> M-x flymake-mode
>
> Produces a warning:
>
> Disabling elisp-flymake-byte-compile in early-init.el (untrusted content)
>
> custom-file (when not the same as user-init-file) also causes a
> warning. Should these also be trusted by default?
>
> What about files put in place by a system admin or your distro’s
> Emacs package (e.g. site-run-file, default.el)? They generally
> require root priviledges to install so if they can’t be trusted
> you’re already in trouble.
Makes sense to me.
Maybe we should install something like the below?
diff --git a/lisp/files.el b/lisp/files.el
index c92fc0608dd..293f3c59c0d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -748,10 +748,16 @@ trusted-content-p
(with-demoted-errors "trusted-content-p: %S"
(let ((exists (file-exists-p buffer-file-truename)))
(or
- ;; We can't avoid trusting the user's init file.
- (if (and exists user-init-file)
- (file-equal-p buffer-file-truename user-init-file)
- (equal buffer-file-truename user-init-file))
+ ;; We can't avoid trusting the user's init file, etc.
+ (memq t
+ (mapcar
+ (lambda (file)
+ (if (and exists file)
+ (file-equal-p buffer-file-truename file)
+ (equal buffer-file-truename file)))
+ (list user-init-file
+ early-init-file
+ site-run-file)))
(let ((file (abbreviate-file-name buffer-file-truename))
(trusted nil))
(dolist (tf trusted-content)
next prev parent reply other threads:[~2024-12-22 2:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-21 20:48 bug#75017: 31.0.50; Untrusted user lisp files john muhl
2024-12-22 2:47 ` Stefan Kangas [this message]
2024-12-22 3:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-22 6:12 ` Eli Zaretskii
2024-12-22 6:19 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADwFkmk-W0ijE_4T0LMc3wqcp8BojQsb-+i998W6kZ2Hqnb2Wg@mail.gmail.com \
--to=stefankangas@gmail.com \
--cc=75017@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=eliz@gnu.org \
--cc=jm@pub.pink \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.