-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add option for safe iframe hosts using array lookup (#423)
Co-authored-by: Edward Z. Yang <[email protected]>
- Loading branch information
Showing
7 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeHosts.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
URI.SafeIframeHosts | ||
TYPE: lookup/null | ||
DEFAULT: null | ||
--DESCRIPTION-- | ||
<p> | ||
A whitelist which indicates what explicit hosts should be | ||
allowed to embed iframe. See also %HTML.SafeIframeRegexp, | ||
it has precedence over this config. Here are some example values: | ||
</p> | ||
<ul> | ||
<li><code>www.youtube.com</code> - Allow YouTube videos</li> | ||
<li><code>maps.google.com</code> - Allow Embedding a Google map</li> | ||
</ul> | ||
--# vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/HTMLPurifier/HTMLT/safe-iframe-youtube-with-array-lookup.htmlt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--INI-- | ||
HTML.SafeIframe = true | ||
URI.SafeIframeHosts = www.youtube.com | ||
--HTML-- | ||
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/RVtEQxH7PWA" frameborder="0" allowfullscreen></iframe> | ||
--EXPECT-- | ||
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/RVtEQxH7PWA" frameborder="0"></iframe> | ||
--# vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters