emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] [Babel] Quotes-in-strings not being escaped in python, breaking output
Date: Tue, 09 Nov 2010 16:34:19 -0600	[thread overview]
Message-ID: <87aalijfdg.fsf@dustycloud.org> (raw)
In-Reply-To: <87k4kmjuhm.fsf@dustycloud.org> (Christopher Allan Webber's message of "Tue, 09 Nov 2010 11:07:49 -0600")

I worry about this a bit because of the possible security issue: the
ability to execute arbitrary code, since the structure that gets
constructed is eval'ed.

eg:

#+BEGIN_SRC python
return [['607', 'Show license short name on the deed'],
        ['255', "'))(message (concat 'hello ' 'world"]]
#+END_SRC

That constructs a set of listp objects which are evaluated and look
like:

'(("607" "Show license short name on the deed") ("255" ""))
(message (concat "hello " "world"))

It doesn't seem like the second one is being evaluated but it makes me
nervous that it's being passed through eval like this at all.

Christopher Allan Webber <cwebber@dustycloud.org> writes:

> It looks like \' and " are not being escaped in
> org-babel-python-table-or-string, which is the problem.
>
> Christopher Allan Webber <cwebber@dustycloud.org> writes:
>
>> Strings with quotes in them aren't having the inner quotes escaped right
>> while read by ob-python in python.  Example:
>>
>> #+BEGIN_SRC python
>> return [['607', 'Show license short name on the deed'],
>>         ['255', '"Smart" 404 pages']]
>> #+END_SRC
>>
>> #+results:
>> | 607 | Show license short name on the deed |       |           |
>> | 255 |                                     | Smart | 404 pages |
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-11-09 22:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 16:58 [BUG] [Babel] Quotes-in-strings not being escaped in python, breaking output Christopher Allan Webber
2010-11-09 17:07 ` Christopher Allan Webber
2010-11-09 22:34   ` Christopher Allan Webber [this message]
2010-11-23  1:57     ` Eric Schulte

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=87aalijfdg.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --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).