From: Daniel Kraus <daniel@kraus.my>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-clojure.el: Add support for babashka and nbb backend
Date: Sun, 14 Nov 2021 17:30:43 +0100 [thread overview]
Message-ID: <87v90u66et.fsf@kraus.my> (raw)
In-Reply-To: <smrd98$h53$1@ciao.gmane.io>
Hi!
Max Nikulin <manikulin@gmail.com> writes:
> On 14/11/2021 22:28, Daniel Kraus wrote:
>> +(defun ob-clojure-escape-quotes (str-val)
>> + "Escape quotes for STR-VAL."
>> + (replace-regexp-in-string "\"" "\\\"" str-val 'FIXEDCASE 'LITERAL))
>> +
>> +(defun ob-clojure-eval-with-babashka (bb expanded)
>> + "Evaluate EXPANDED code block using BB (babashka or nbb)."
>> + (let ((escaped (ob-clojure-escape-quotes expanded)))
>> + (shell-command-to-string
>> + (concat bb " -e \"" escaped "\""))))
>
> Does not it an open door for security vulnerabilities? Consider a string
> somewhere in the code: "`echo arbitrary code execution`". Only outer quotes are
> escaped.
The escaping is not done for security reasons.
When I have a babel block like
#+BEGIN_SRC clojure
(str "foo" "bar")
#+END_SRC
babashka has to be called with
bb -e "(str \"foo\" \"bar\")"
etc.
Security wise someone should always be careful what he
evaluates in an org-babel block.
Nobody prevents you from evaluating
#+BEGIN_SRC shell
sudo rm -rf /
#+END_SRC
Cheers,
Daniel
next prev parent reply other threads:[~2021-11-14 16:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-14 15:28 [PATCH] ob-clojure.el: Add support for babashka and nbb backend Daniel Kraus
2021-11-14 16:25 ` Max Nikulin
2021-11-14 16:30 ` Daniel Kraus [this message]
2021-11-15 14:33 ` Max Nikulin
2021-11-15 16:05 ` Daniel Kraus
2021-11-17 16:12 ` Max Nikulin
2021-11-20 10:18 ` Daniel Kraus
2021-12-22 22:34 ` Daniel Kraus
2022-01-31 7:58 ` Daniel Kraus
2022-02-02 15:58 ` Max Nikulin
2022-06-11 7:45 ` Ihor Radchenko
2022-09-25 3:10 ` Bastien
2022-09-25 13:37 ` Christopher M. Miles
2022-09-25 13:43 ` Christopher M. Miles
[not found] ` <20969.6847757854$1664113375@news.gmane.org>
2022-09-25 13:48 ` Bastien
2022-09-26 16:02 ` Daniel Kraus
2022-09-27 2:31 ` Ihor Radchenko
2022-09-27 19:39 ` Bastien
2022-09-28 1:16 ` [WORG] Document in more detail about what maintainers do? (was: [PATCH] ob-clojure.el: Add support for babashka and nbb backend) Ihor Radchenko
2022-09-28 6:56 ` [WORG] Document in more detail about what maintainers do? Bastien
2022-09-29 7:06 ` Ihor Radchenko
2022-10-29 6:28 ` Ihor Radchenko
2022-10-29 8:06 ` Bastien Guerry
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v90u66et.fsf@kraus.my \
--to=daniel@kraus.my \
--cc=emacs-orgmode@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).