emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command
Date: Tue, 12 Mar 2024 13:03:01 +0000	[thread overview]
Message-ID: <87v85rd2m2.fsf@localhost> (raw)
In-Reply-To: <ushuu6$hpn$1@ciao.gmane.io>

Max Nikulin <manikulin@gmail.com> writes:

>> Even stripping quotes is unreliable when we use the example from
>> docstring: 'literal:%i'.
>
> My idea is to recognize this case. If stripping is not performed then it 
> is necessary to detect if user command is safe. Otherwise apostrophe in 
> a formula (even after escaping) may cause leaking math to shell. I have 
> not figured out if it is possible to bypass double quotes, but extra 
> slashes may distort math expression.
>
> It is trivial to cause shell failure when single quotes are used around 
> %i. I am in doubts concerning double quotes. Perhaps stripping them is 
> more reliable.

May you list the cases to you propose to recognize?

>> Attaching tentative patch that fixes the problem.
>
> I think it is in the right direction.
> - Manual needs update as well.

Yes,

  #+begin_src emacs-lisp
  (setq org-latex-to-mathml-convert-command
        "latexmlmath \"%i\" --presentationmathml=%o")
  #+end_src

example in "LaTeX math snippets" section should be updated. (note to self)

> - I would explicitly stress that quotes causes undefined or even 
> dangerous behavior. See e.g. the last paragraph
> https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html

In ORG-NEWS?

> - I expected it as bugfix.

It is a breaking change.
Also, only users who customized the variable may be prone to unexpected
shell expansion. So, I do not see it as a critical bug.
Hence, not for bugfix.

> I have tried to add some unit tests, but I faced an issue with 
> `org-create-math-formula'. It creates temporary files in 
> `default-directory' and does not remove them on failure. Moreover, it 
> does not work in a container where git is not installed:
> ...
> Debugger entered--Lisp error: (file-missing "Searching for program" "No 
> such file or directory" "git")
>
> that is called from `find-file-hook'.

with emacs -Q?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  parent reply	other threads:[~2024-03-12 12:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 23:10 Warn about shell-expansion in the docstring of org-latex-to-html-convert-command Martin Edström
2024-02-18 16:06 ` Ihor Radchenko
2024-02-18 18:56   ` Martin Edström
2024-02-18 19:36     ` Martin Edström
2024-02-19  8:30       ` Ihor Radchenko
2024-02-21 14:38       ` Max Nikulin
2024-02-21 14:57         ` Martin Edström
2024-02-21 15:04         ` Martin Edström
2024-02-21 15:08           ` Martin Edström
2024-02-23 12:46         ` Ihor Radchenko
2024-02-25 10:41           ` Max Nikulin
2024-02-26 10:48             ` Ihor Radchenko
2024-02-26 16:37               ` Max Nikulin
2024-03-08 11:16                 ` Ihor Radchenko
2024-03-09 15:23                   ` Max Nikulin
2024-03-10  5:02                     ` [PATCH] Unit tests for function calling MathML converters (Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command) Max Nikulin
2024-03-31  8:27                       ` Ihor Radchenko
2024-04-01 10:39                         ` Max Nikulin
2024-04-01 11:23                           ` Ihor Radchenko
2024-03-12 13:03                     ` Ihor Radchenko [this message]
2024-03-13 14:27                       ` Warn about shell-expansion in the docstring of org-latex-to-html-convert-command Max Nikulin
2024-03-15 13:49                         ` Ihor Radchenko
2024-03-18 10:50                           ` Max Nikulin
2024-03-19 14:48                             ` Ihor Radchenko
2024-03-19 14:49                               ` Ihor Radchenko
2024-03-19 16:22                                 ` Max Nikulin
2024-03-19 16:27                                   ` Ihor Radchenko
2024-03-19 16:45                                     ` fixup! and git Max Nikulin
2024-03-19 16:50                                       ` Ihor Radchenko
2024-03-31  8:25                     ` Warn about shell-expansion in the docstring of org-latex-to-html-convert-command Ihor Radchenko
2024-04-01 10:29                       ` Max Nikulin
2024-04-01 11:15                         ` Ihor Radchenko
2024-03-05 12:01             ` Max Nikulin

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=87v85rd2m2.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /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).