Issues (170)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

tests/MailSo/Mime/EmailTest.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace MailSoTests;
4
5
class EmailTest extends \PHPUnit_Framework_TestCase
6
{
7
	public function testNewInstance()
8
	{
9
		$oMail = \MailSo\Mime\Email::NewInstance('[email protected]', 'Administrator');
10
		$this->assertEquals('[email protected]', $oMail->GetEmail());
11
		$this->assertEquals('Administrator', $oMail->GetDisplayName());
12
		$this->assertEquals('admin', $oMail->GetAccountName());
13
		$this->assertEquals('example.com', $oMail->GetDomain());
14
		$this->assertEquals('"Administrator" <[email protected]>', $oMail->ToString());
15
		$this->assertEquals(array('Administrator', '[email protected]', 'none', ''), $oMail->ToArray());
16
	}
17
18 View Code Duplication
	public function testNewInstance1()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
	{
20
		$oMail = \MailSo\Mime\Email::NewInstance('[email protected]');
21
		$this->assertEquals('[email protected]', $oMail->GetEmail());
22
		$this->assertEquals('', $oMail->GetDisplayName());
23
		$this->assertEquals('[email protected]', $oMail->ToString());
24
		$this->assertEquals(array('', '[email protected]', 'none', ''), $oMail->ToArray());
25
	}
26
27 View Code Duplication
	public function testNewInstance2()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
	{
29
		$oMail = \MailSo\Mime\Email::NewInstance('[email protected]', 'Administrator');
30
		$this->assertEquals('[email protected]', $oMail->GetEmail());
31
		$this->assertEquals('Administrator', $oMail->GetDisplayName());
32
		$this->assertEquals('"Administrator" <[email protected]>', $oMail->ToString());
33
		$this->assertEquals(array('Administrator', '[email protected]', 'none', ''), $oMail->ToArray());
34
	}
35
36 View Code Duplication
	public function testNewInstance3()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
	{
38
		$oMail = \MailSo\Mime\Email::NewInstance('[email protected]', '');
39
		$this->assertEquals('[email protected]', $oMail->GetEmail());
40
		$this->assertEquals('', $oMail->GetDisplayName());
41
		$this->assertEquals('[email protected]', $oMail->ToString());
42
		$this->assertEquals(array('', '[email protected]', 'none', ''), $oMail->ToArray());
43
	}
44
45
	/**
46
	 * @expectedException \MailSo\Base\Exceptions\InvalidArgumentException
47
	 */
48
	public function testNewInstance4()
49
	{
50
		$oMail = \MailSo\Mime\Email::NewInstance('');
0 ignored issues
show
$oMail is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
51
	}
52
53
	public function testParse1()
54
	{
55
		$oMail = \MailSo\Mime\Email::Parse('[email protected]');
56
		$this->assertEquals('[email protected]', $oMail->GetEmail());
57
58
		$oMail = \MailSo\Mime\Email::Parse('<[email protected]>');
59
		$this->assertEquals('[email protected]', $oMail->GetEmail());
60
	}
61
62
	public function testParse2()
63
	{
64
		$oMail = \MailSo\Mime\Email::Parse('"Тест" <[email protected]>');
65
		$this->assertEquals('"Тест" <[email protected]>', $oMail->ToString());
66
	}
67
68
	public static function providerForParse()
69
	{
70
		return array(
71
			array('test <[email protected]>',
72
				array('test', '[email protected]')),
73
			array('test<[email protected]>',
74
				array('test', '[email protected]')),
75
			array('test< [email protected] >',
76
				array('test', '[email protected]')),
77
			array('"New \" Admin" <[email protected]>',
78
				array('New " Admin', '[email protected]')),
79
			array('"Тест" <[email protected]>',
80
				array('Тест', '[email protected]')),
81
			array('Microsoft Outlook<[email protected]>',
82
				array('Microsoft Outlook', '[email protected]')),
83
		);
84
	}
85
86
	public static function providerForParse2()
87
	{
88
		return array(
89
			array('[email protected]',
90
				array('', 'help@президент.рф')),
91
		);
92
	}
93
94
	/**
95
     * @dataProvider providerForParse
96
     */
97
	public function testParseWithProvider($sValue, $aResult)
98
	{
99
		$oMail = \MailSo\Mime\Email::Parse($sValue);
100
		$this->assertEquals($aResult, $oMail->ToArray(false, false));
101
	}
102
103
	/**
104
     * @dataProvider providerForParse2
105
     */
106
	public function testParseWithProvider2($sValue, $aResult)
107
	{
108
		$oMail = \MailSo\Mime\Email::Parse($sValue);
109
		$this->assertEquals($aResult, $oMail->ToArray(true, false));
110
	}
111
112
	/**
113
	 * @expectedException \MailSo\Base\Exceptions\InvalidArgumentException
114
	 */
115
	public function testParse5()
116
	{
117
		\MailSo\Mime\Email::Parse('');
118
	}
119
120
	/**
121
	 * @expectedException \MailSo\Base\Exceptions\InvalidArgumentException
122
	 */
123
	public function testParse6()
124
	{
125
		\MailSo\Mime\Email::Parse('example.com');
126
	}
127
}
128