Limit a story to 64 KB before HTML Purifier runs.
A preview purified any posted story, even without a token or a captcha. A few megabytes took seconds and hundreds of megabytes.
This commit is contained in:
@@ -35,6 +35,12 @@ class ValidateDataTest extends TestCase {
|
||||
$this->assertSame(array(), $this->validate(array('remove_img' => '1')));
|
||||
}
|
||||
|
||||
public function testATooLongStoryIsRefused(): void {
|
||||
$this->assertSame(array(), $this->validate(array('story' => str_repeat('a', 65536))));
|
||||
$this->assertSame(array('story' => 'The story is too long. Please shorten it.'),
|
||||
$this->validate(array('story' => str_repeat('a', 65537))));
|
||||
}
|
||||
|
||||
public function testVisitorsNeedTheCaptcha(): void {
|
||||
FakeRecaptcha::install('{"tokenProperties":{"valid":false}}');
|
||||
$this->assertSame(array('captcha' => 'Please complete the captcha.'), $this->validate(array('g-recaptcha-response' => 'r'), FALSE));
|
||||
|
||||
Reference in New Issue
Block a user