Server geändert
This commit is contained in:
@ -15,7 +15,7 @@ class HTMLPurifier_HTMLModule_FormsTest extends HTMLPurifier_HTMLModuleHarness
|
||||
$this->config->set('HTML.Doctype', 'HTML 4.01 Strict');
|
||||
$this->assertResult( // need support for label for later
|
||||
'
|
||||
<form action="http://somesite.com/prog/adduser" method="post">
|
||||
<form action="https://somesite.com/prog/adduser" method="post">
|
||||
<p>
|
||||
<label>First name: </label>
|
||||
<input type="text" id="firstname" /><br />
|
||||
@ -35,7 +35,7 @@ class HTMLPurifier_HTMLModule_FormsTest extends HTMLPurifier_HTMLModuleHarness
|
||||
{
|
||||
$this->config->set('HTML.Doctype', 'HTML 4.01 Strict');
|
||||
$this->assertResult('
|
||||
<form action="http://somesite.com/prog/component-select" method="post">
|
||||
<form action="https://somesite.com/prog/component-select" method="post">
|
||||
<p>
|
||||
<select multiple="multiple" size="4" name="component-select">
|
||||
<option selected="selected" value="Component_1_a">Component_1</option>
|
||||
@ -56,7 +56,7 @@ class HTMLPurifier_HTMLModule_FormsTest extends HTMLPurifier_HTMLModuleHarness
|
||||
{
|
||||
$this->config->set('HTML.Doctype', 'HTML 4.01 Strict');
|
||||
$this->assertResult('
|
||||
<form action="http://somesite.com/prog/someprog" method="post">
|
||||
<form action="https://somesite.com/prog/someprog" method="post">
|
||||
<p>
|
||||
<select name="ComOS">
|
||||
<option selected="selected" label="none" value="none">None</option>
|
||||
@ -83,7 +83,7 @@ class HTMLPurifier_HTMLModule_FormsTest extends HTMLPurifier_HTMLModuleHarness
|
||||
{
|
||||
$this->config->set('HTML.Doctype', 'HTML 4.01 Strict');
|
||||
$this->assertResult('
|
||||
<form action="http://somesite.com/prog/text-read" method="post">
|
||||
<form action="https://somesite.com/prog/text-read" method="post">
|
||||
<p>
|
||||
<textarea name="thetext" rows="20" cols="80">
|
||||
First line of initial text.
|
||||
|
@ -13,15 +13,15 @@ class HTMLPurifier_HTMLModule_NofollowTest extends HTMLPurifier_HTMLModuleHarnes
|
||||
public function testNofollow()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">x</a><a href="http://google.com" rel="blah">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
|
||||
'<a href="http://google.com" rel="nofollow">x</a><a href="http://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
'<a href="https://google.com">x</a><a href="https://google.com" rel="blah">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
|
||||
'<a href="https://google.com" rel="nofollow">x</a><a href="https://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testNofollowDupe()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" rel="nofollow">x</a><a href="http://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
'<a href="https://google.com" rel="nofollow">x</a><a href="https://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -25,12 +25,12 @@ class HTMLPurifier_HTMLModule_ObjectTest extends HTMLPurifier_HTMLModuleHarness
|
||||
public function testStandardUseCase()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<object type="video/x-ms-wmv" data="http://domain.com/video.wmv" width="320" height="256">
|
||||
<param name="src" value="http://domain.com/video.wmv" />
|
||||
'<object type="video/x-ms-wmv" data="https://domain.com/video.wmv" width="320" height="256">
|
||||
<param name="src" value="https://domain.com/video.wmv" />
|
||||
<param name="autostart" value="false" />
|
||||
<param name="controller" value="true" />
|
||||
<param name="pluginurl" value="http://www.microsoft.com/Windows/MediaPlayer/" />
|
||||
<a href="http://www.microsoft.com/Windows/MediaPlayer/">Windows Media player required</a>
|
||||
<param name="pluginurl" value="https://www.microsoft.com/Windows/MediaPlayer/" />
|
||||
<a href="https://www.microsoft.com/Windows/MediaPlayer/">Windows Media player required</a>
|
||||
</object>'
|
||||
);
|
||||
}
|
||||
|
@ -13,31 +13,31 @@ class HTMLPurifier_HTMLModule_SafeEmbedTest extends HTMLPurifier_HTMLModuleHarne
|
||||
public function testMinimal()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" />',
|
||||
'<embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" allowscriptaccess="never" allownetworking="internal" type="application/x-shockwave-flash" />'
|
||||
'<embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" />',
|
||||
'<embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" allowscriptaccess="never" allownetworking="internal" type="application/x-shockwave-flash" />'
|
||||
);
|
||||
}
|
||||
|
||||
public function testYouTube()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed>',
|
||||
'<embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="never" allownetworking="internal" />'
|
||||
'<embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed>',
|
||||
'<embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="never" allownetworking="internal" />'
|
||||
);
|
||||
}
|
||||
|
||||
public function testMalicious()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<embed src="http://example.com/bad.swf" type="application/x-shockwave-flash" width="9999999" height="3499994" allowscriptaccess="always" allownetworking="always" />',
|
||||
'<embed src="http://example.com/bad.swf" type="application/x-shockwave-flash" width="1200" height="1200" allowscriptaccess="never" allownetworking="internal" />'
|
||||
'<embed src="https://example.com/bad.swf" type="application/x-shockwave-flash" width="9999999" height="3499994" allowscriptaccess="always" allownetworking="always" />',
|
||||
'<embed src="https://example.com/bad.swf" type="application/x-shockwave-flash" width="1200" height="1200" allowscriptaccess="never" allownetworking="internal" />'
|
||||
);
|
||||
}
|
||||
|
||||
public function testFull()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<b><embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="24" height="23" allowscriptaccess="never" allownetworking="internal" wmode="window" /></b>'
|
||||
'<b><embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="24" height="23" allowscriptaccess="never" allownetworking="internal" wmode="window" /></b>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,23 +22,23 @@ class HTMLPurifier_HTMLModule_SafeObjectTest extends HTMLPurifier_HTMLModuleHarn
|
||||
{
|
||||
// embed is purposely removed
|
||||
$this->assertResult(
|
||||
'<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/RVtEQxH7PWA&hl=en"></param><embed src="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed></object>',
|
||||
'<object width="425" height="344" data="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" /></object>'
|
||||
'<object width="425" height="344"><param name="movie" value="https://www.youtube.com/v/RVtEQxH7PWA&hl=en"></param><embed src="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed></object>',
|
||||
'<object width="425" height="344" data="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" /></object>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testMalicious()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<object width="9999999" height="9999999"><param name="allowScriptAccess" value="always" /><param name="movie" value="http://example.com/attack.swf" /></object>',
|
||||
'<object width="1200" height="1200" data="http://example.com/attack.swf" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="http://example.com/attack.swf" /></object>'
|
||||
'<object width="9999999" height="9999999"><param name="allowScriptAccess" value="always" /><param name="movie" value="https://example.com/attack.swf" /></object>',
|
||||
'<object width="1200" height="1200" data="https://example.com/attack.swf" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="https://example.com/attack.swf" /></object>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testFull()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<b><object width="425" height="344" type="application/x-shockwave-flash" data="Foobar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="flashvars" value="foobarbaz=bally" /><param name="movie" value="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" /><param name="wmode" value="window" /></object></b>'
|
||||
'<b><object width="425" height="344" type="application/x-shockwave-flash" data="Foobar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="flashvars" value="foobarbaz=bally" /><param name="movie" value="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" /><param name="wmode" value="window" /></object></b>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class HTMLPurifier_HTMLModule_SafeObjectTest extends HTMLPurifier_HTMLModuleHarn
|
||||
{
|
||||
$this->config->set('HTML.FlashAllowFullScreen', true);
|
||||
$this->assertResult(
|
||||
'<b><object width="425" height="344" type="application/x-shockwave-flash" data="Foobar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="flashvars" value="foobarbaz=bally" /><param name="movie" value="http://www.youtube.com/v/RVtEQxH7PWA&hl=en" /><param name="wmode" value="window" /><param name="allowFullScreen" value="true" /></object></b>'
|
||||
'<b><object width="425" height="344" type="application/x-shockwave-flash" data="Foobar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="flashvars" value="foobarbaz=bally" /><param name="movie" value="https://www.youtube.com/v/RVtEQxH7PWA&hl=en" /><param name="wmode" value="window" /><param name="allowFullScreen" value="true" /></object></b>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleH
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->config->set('HTML.SafeScripting', array('http://localhost/foo.js'));
|
||||
$this->config->set('HTML.SafeScripting', array('https://localhost/foo.js'));
|
||||
}
|
||||
|
||||
public function testMinimal()
|
||||
@ -20,14 +20,14 @@ class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleH
|
||||
public function testGood()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<script type="text/javascript" src="http://localhost/foo.js" />'
|
||||
'<script type="text/javascript" src="https://localhost/foo.js" />'
|
||||
);
|
||||
}
|
||||
|
||||
public function testBad()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<script type="text/javascript" src="http://localhost/foobar.js" />',
|
||||
'<script type="text/javascript" src="https://localhost/foobar.js" />',
|
||||
''
|
||||
);
|
||||
}
|
||||
|
@ -12,15 +12,15 @@ class HTMLPurifier_HTMLModule_TargetBlankTest extends HTMLPurifier_HTMLModuleHar
|
||||
public function testTargetBlank()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer noopener">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
'<a href="https://google.com">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer noopener">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testTargetBlankNoDupe() {
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" target="_blank">a</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer noopener">a</a>'
|
||||
'<a href="https://google.com" target="_blank">a</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer noopener">a</a>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ class HTMLPurifier_HTMLModule_TargetNoopenerTest extends HTMLPurifier_HTMLModule
|
||||
public function testNoreferrer()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" target="_blank">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noopener">x</a>'
|
||||
'<a href="https://google.com" target="_blank">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noopener">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@ class HTMLPurifier_HTMLModule_TargetNoopenerTest extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
$this->config->set('Attr.AllowedRel', 'noopener');
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" target="_blank" rel="noopener">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noopener">x</a>'
|
||||
'<a href="https://google.com" target="_blank" rel="noopener">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noopener">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,16 +32,16 @@ class HTMLPurifier_HTMLModule_TargetNoopenerTest extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
$this->config->set('HTML.TargetBlank', true);
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noopener">x</a>'
|
||||
'<a href="https://google.com">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noopener">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testNoTarget()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">x</a>',
|
||||
'<a href="http://google.com">x</a>'
|
||||
'<a href="https://google.com">x</a>',
|
||||
'<a href="https://google.com">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ class HTMLPurifier_HTMLModule_TargetNoreferrerTest extends HTMLPurifier_HTMLModu
|
||||
public function testNoreferrer()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" target="_blank">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
'<a href="https://google.com" target="_blank">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@ class HTMLPurifier_HTMLModule_TargetNoreferrerTest extends HTMLPurifier_HTMLModu
|
||||
{
|
||||
$this->config->set('Attr.AllowedRel', 'noreferrer');
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,16 +32,16 @@ class HTMLPurifier_HTMLModule_TargetNoreferrerTest extends HTMLPurifier_HTMLModu
|
||||
{
|
||||
$this->config->set('HTML.TargetBlank', true);
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">x</a>',
|
||||
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
'<a href="https://google.com">x</a>',
|
||||
'<a href="https://google.com" target="_blank" rel="noreferrer">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
public function testNoTarget()
|
||||
{
|
||||
$this->assertResult(
|
||||
'<a href="http://google.com">x</a>',
|
||||
'<a href="http://google.com">x</a>'
|
||||
'<a href="https://google.com">x</a>',
|
||||
'<a href="https://google.com">x</a>'
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user