[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 10e857d428 2/2: org-babel-read: Obey `org-confirm-b
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 10e857d428 2/2: org-babel-read: Obey `org-confirm-babel-evaluate' |
Date: |
Thu, 10 Nov 2022 00:58:08 -0500 (EST) |
branch: externals/org
commit 10e857d42859a55b23cd4206ffce3ebd0f678583
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-babel-read: Obey `org-confirm-babel-evaluate'
* lisp/ob-core.el (org-babel-read): Do not execute arbitrary Elisp
without prompt, according to `org-confirm-babel-evaluate'.
Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tjct9e$179u$1@ciao.gmane.io
---
lisp/ob-core.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 91938d7e59..1259909a02 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -3170,7 +3170,16 @@ situations in which is it not appropriate."
((and (not inhibit-lisp-eval)
(or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
(string= cell "*this*")))
- (eval (read cell) t))
+ ;; Prevent arbitrary function calls.
+ (if (and (memq (string-to-char cell) '(?\( ?`))
+ (not (org-babel-confirm-evaluate
+ ;; See `org-babel-get-src-block-info'.
+ (list "emacs-lisp" (format "%S" cell)
+ '((:eval . yes)) nil (format "%S" cell)
+ nil nil))))
+ ;; Not allowed.
+ (user-error "Evaluation of elisp code %S aborted." cell)
+ (eval (read cell) t)))
((save-match-data
(and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
(not (string-match "[^\\]\"" (match-string 1 cell)))))