Tom, does not the following allow to achieve the same without your patch?

#+begin_src elisp :results none
  (setq-local
   org-confirm-babel-evaluate
   (lambda (lang body)
     (not
      (and
       (member lang '("elisp" "emacs-lisp"))
       (let ((rb (read body)))
         (or
          (member rb
                  '((or)
                    (and)
                    ;; add more forms that are known safe here
                    ))
          (and
           (eq (car rb) 'identity)
           (let ((v (cadr rb)))
             (or
              (symbolp v)
              (stringp v)
              (numberp v)
              )))))))))
#+end_src

I know, it does not work, but I think it is due to (format "%S" cell) instead of passing cell directly in

-                            '((:eval . yes)) nil (format "%S" cell)

My point is that if some expression is safe for a variable value then it is safe for the source block body.

On 14/12/2022 04:16, Tom Gillespie wrote:
Will it be clear to users what "cell" means in this context?

I assume the language was originally chosen
with tables in mind, but I think it is clear? The
one issue is that using org-babel-confirm-evaluate
doesn't use the word "cell" in the yes-or-no-p prompt.

Have you ever seen the prompt for a table?

I suppose, tables are the most prominent security issue related to unsolicited code execution:

Max Nikulin to emacs-orgmode. Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution. Fri, 28 Oct 2022 11:11:18 +0700. https://list.orgmode.org/tjfkp7$ggm$1...@ciao.gmane.io

I am still in doubts if

10e857d42 2022-10-28 11:09:50 +0800 Ihor Radchenko: org-babel-read: Obey `org-confirm-babel-evaluate'

was an unambiguous improvement. Perhaps it just forces more users to set `org-confirm-babel-evaluate' to nil compromising their security to more severe degree.


Reply via email to