unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Vasilij Schneidermann <mail@vasilij.de>, emacs-devel@gnu.org
Subject: Re: Structurally fixing command injection bugs
Date: Wed, 22 Feb 2023 10:57:24 -0800	[thread overview]
Message-ID: <e5e76559-dab9-425c-60ae-8587f06dcea5@gmail.com> (raw)
In-Reply-To: <Y/XphtONmV9h5tsm@odonien>

On 2/22/2023 2:08 AM, Vasilij Schneidermann wrote:
> I see several options for moving forward:
[snip]
> - Come up with a different replacement working much like
>    `process-lines`, but returning a string instead (I have no idea what
>    an appropriate name would be, maybe `command-to-string`?)

Where possible, I think this is probably best, but there are likely 
times where you really want the benefits of a shell. For example, what 
if the command you want to run involves a pipeline? One option for this 
would be to enhance 'shell-command-to-string' so that you can pass it 
arguments that will be correctly escaped when substituted into the final 
command string. For example:

   (shell-command-to-string "cat %s | rev" "file with a $weird name.txt")
   ;; Runs "cat 'file with a $weird name.txt' | rev"

(This is similar to what you might do when parameterizing an SQL query 
or something.)



      parent reply	other threads:[~2023-02-22 18:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 10:08 Structurally fixing command injection bugs Vasilij Schneidermann
2023-02-22 10:20 ` lux
2023-02-22 10:34   ` Vasilij Schneidermann
2023-02-22 12:05     ` lux
2023-02-22 12:57     ` Gregory Heytings
2023-02-22 12:01 ` lux
2023-02-22 18:57 ` Jim Porter [this message]

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5e76559-dab9-425c-60ae-8587f06dcea5@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=mail@vasilij.de \
    /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.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).