mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-11 15:44:34 +02:00
Prevent header injection through content type / encoding in NativeMailerHandler, fixes #458, closes #448
This commit is contained in:
@@ -40,4 +40,22 @@ class NativeMailerHandlerTest extends TestCase
|
||||
$mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
|
||||
$mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testSetterContentTypeInjection()
|
||||
{
|
||||
$mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
|
||||
$mailer->setContentType("text/html\r\nFrom: faked@attacker.org");
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testSetterEncodingInjection()
|
||||
{
|
||||
$mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
|
||||
$mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user