]> git.eshelyaron.com Git - emacs.git/commitdiff
Trust nothing by default
authorEshel Yaron <me@eshelyaron.com>
Tue, 24 Dec 2024 17:14:12 +0000 (18:14 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 24 Dec 2024 17:14:12 +0000 (18:14 +0100)
lisp/files.el

index 6657588bc0ffbf1adae4218a916a7afa284f95b2..321dec36acd52d11e389ce94d816b5b8e8275007 100644 (file)
@@ -746,22 +746,17 @@ See also `trusted-content'."
          buffer-file-truename
          (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))
-              (let ((file (abbreviate-file-name buffer-file-truename))
-                    (trusted nil))
-                (dolist (tf trusted-content)
-                  (when (or (if exists (file-equal-p tf file) (equal tf file))
-                            ;; We don't use `file-in-directory-p' here, because
-                            ;; we want to err on the conservative side: "guilty
-                            ;; until proven innocent".
-                            (and (string-suffix-p "/" tf)
-                                 (string-prefix-p tf file)))
-                    (setq trusted t)))
-                trusted))))))))
+             (let ((file (abbreviate-file-name buffer-file-truename))
+                   (trusted nil))
+               (dolist (tf trusted-content)
+                 (when (or (if exists (file-equal-p tf file) (equal tf file))
+                           ;; We don't use `file-in-directory-p' here, because
+                           ;; we want to err on the conservative side: "guilty
+                           ;; until proven innocent".
+                           (and (string-suffix-p "/" tf)
+                                (string-prefix-p tf file)))
+                   (setq trusted t)))
+               trusted)))))))
 
 ;; This is an odd variable IMO.
 ;; You might wonder why it is needed, when we could just do: