diff options
| author | Eli Zaretskii | 2017-09-16 12:45:24 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-09-16 12:45:24 +0300 |
| commit | a103dbe36022cd2454eaeed96def1c777c049762 (patch) | |
| tree | a3455f3e0ef50b9bbc1085c3199b4434851ebf35 /doc | |
| parent | 6d6dc246f93486fc8370399b6e1af8a17f371e4f (diff) | |
| download | emacs-a103dbe36022cd2454eaeed96def1c777c049762.tar.gz emacs-a103dbe36022cd2454eaeed96def1c777c049762.zip | |
Disable execution of unsafe Lisp by Enriched Text mode
* src/xdisp.c (handle_display_spec): If the display property is
wrapped in 'disable-eval' form, disable Lisp evaluation while
processing this property.
(handle_single_display_spec): Accept new argument ENABLE_EVAL_P.
If that argument is false, don't evaluate Lisp while processing
display properties.
* lisp/textmodes/enriched.el
(enriched-allow-eval-in-display-props): New defcustom.
(enriched-decode-display-prop): If
enriched-allow-eval-in-display-props is nil, wrap the display
property with 'disable-eval' to disable Lisp evaluation when the
display property is processed for display. (Bug#28350)
* lisp/gnus/mm-view.el (mm-inline-text): Re-enable processing of
enriched text.
* doc/lispref/display.texi (Display Property): Document the
'disable-eval' wrapping of 'display' properties.
* doc/emacs/text.texi (Enriched Properties): Document
'enriched-allow-eval-in-display-props'.
* etc/NEWS: Describe the security issues with Enriched Text mode
and their solution.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/text.texi | 17 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 3b54aa82631..496b43ce1e3 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi | |||
| @@ -2398,6 +2398,23 @@ these special properties from the text in the region. | |||
| 2398 | 2398 | ||
| 2399 | The @code{invisible} and @code{intangible} properties are not saved. | 2399 | The @code{invisible} and @code{intangible} properties are not saved. |
| 2400 | 2400 | ||
| 2401 | @vindex enriched-allow-eval-in-display-props | ||
| 2402 | @cindex security, when displaying enriched text | ||
| 2403 | Enriched mode also supports saving and restoring @code{display} | ||
| 2404 | properties (@pxref{Display Property,,,elisp, the Emacs Lisp Reference | ||
| 2405 | Manual}), which affect how text is displayed on the screen, and also | ||
| 2406 | allow displaying images and strings that come from sources other than | ||
| 2407 | buffer text. The @code{display} properties also support execution of | ||
| 2408 | arbitrary Lisp forms as part of processing the property for display, | ||
| 2409 | thus providing a means to dynamically tailor the display to some | ||
| 2410 | conditions that can only be known at display time. Since execution of | ||
| 2411 | arbitrary Lisp opens Emacs to potential attacks, especially when the | ||
| 2412 | source of enriched text is outside of Emacs or even outside of your | ||
| 2413 | system (e.g., if it was received in an email message), such execution | ||
| 2414 | is by default disabled in Enriched mode. You can enable it by | ||
| 2415 | customizing the variable @code{enriched-allow-eval-in-display-props} | ||
| 2416 | to a non-@code{nil} value. | ||
| 2417 | |||
| 2401 | @node Text Based Tables | 2418 | @node Text Based Tables |
| 2402 | @section Editing Text-based Tables | 2419 | @section Editing Text-based Tables |
| 2403 | @cindex table mode | 2420 | @cindex table mode |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 1dbc0bbb5bf..3dae984f339 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -4486,6 +4486,17 @@ for the @code{display} property, only one of the values takes effect, | |||
| 4486 | following the rules of @code{get-char-property}. @xref{Examining | 4486 | following the rules of @code{get-char-property}. @xref{Examining |
| 4487 | Properties}. | 4487 | Properties}. |
| 4488 | 4488 | ||
| 4489 | @cindex display property, unsafe evaluation | ||
| 4490 | @cindex security, and display specifications | ||
| 4491 | Some of the display specifications allow inclusion of Lisp forms, | ||
| 4492 | which are evaluated at display time. This could be unsafe in certain | ||
| 4493 | situations, e.g., when the display specification was generated by some | ||
| 4494 | external program/agent. Wrapping a display specification in a list | ||
| 4495 | that begins with the special symbol @code{disable-eval}, as in | ||
| 4496 | @w{@code{('disable-eval @var{spec})}}, will disable evaluation of any | ||
| 4497 | Lisp in @var{spec}, while still supporting all the other display | ||
| 4498 | property features. | ||
| 4499 | |||
| 4489 | The rest of this section describes several kinds of | 4500 | The rest of this section describes several kinds of |
| 4490 | display specifications and what they mean. | 4501 | display specifications and what they mean. |
| 4491 | 4502 | ||