Skip to content

Commit

Permalink
Merge pull request PHPOffice#1338 from pcworld/image-security-doc
Browse files Browse the repository at this point in the history
Improve security-related documentation of addImage and addHtml
  • Loading branch information
troosan authored Apr 13, 2018
2 parents 9989e4e + 6253ada commit 57edede
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ To add an image, use the ``addImage`` method to sections, headers, footers, text
$section->addImage($src, [$style]);
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string.
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. Warning: Do not pass user-generated strings here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing file paths or URLs instead of image data.
- ``$style``. See :ref:`image-style`.

Examples:
Expand Down
2 changes: 2 additions & 0 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class Html
* Add HTML parts.
*
* Note: $stylesheet parameter is removed to avoid PHPMD error for unused parameter
* Warning: Do not pass user-generated HTML here, as that would allow an attacker to read arbitrary
* files or perform server-side request forgery by passing local file paths or URLs in <img>.
*
* @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added
* @param string $html The code to parse
Expand Down

0 comments on commit 57edede

Please sign in to comment.