GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (57)

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/ImapHelperTest.php (2 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
namespace Checkdomain\Comodo\Tests;
3
4
use Checkdomain\Comodo\ImapExtension;
5
use Checkdomain\Comodo\ImapHelper;
6
use Zend\Mail\Storage\Message;
7
8
/**
9
 * Class ImapHelperTest
10
 */
11
class ImapHelperTest extends AbstractTest
12
{
13
    /**
14
     * @var ImapHelper
15
     */
16
    private $imapHelper;
17
18
    /**
19
     * @var array
20
     */
21
    private $messages = [];
22
23
    /**
24
     * @param string $name
25
     * @param array  $data
26
     * @param string $dataName
27
     */
28
    public function __construct($name = null, array $data = [], $dataName = '')
29
    {
30
        parent::__construct($name, $data, $dataName);
31
32
        $this->imapHelper = new ImapHelper();
33
        $this->messages = json_decode(file_get_contents(__DIR__.'/data/messages/messages.json'), true);
0 ignored issues
show
Documentation Bug introduced by
It seems like json_decode(file_get_con.../messages.json'), true) of type * is incompatible with the declared type array of property $messages.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
34
    }
35
36
37
    /**
38
     * @param int $messageId
39
     *
40
     * @return \PHPUnit_Framework_MockObject_MockObject|\Zend\Mail\Storage\Message
41
     */
42
    public function createImapStorageMessage($messageId)
43
    {
44
        $messageData = $this->messages[$messageId];
45
46
        $message = $this
47
            ->getMockBuilder(Message::class)
48
            ->disableOriginalConstructor()
49
            ->disableOriginalClone()
50
            ->getMock();
51
52
        $message
53
            ->expects($this->any())
54
            ->method('getHeader')
55
            ->will($this->returnCallback(function ($index, $type) use ($messageData) {
56
                if ($type != 'string') {
57
                    return null;
58
                }
59
60
                if ($index == 'subject') {
61
                    return utf8_encode($messageData[$index]);
62
                }
63
64
                return $messageData[$index];
65
            }));
66
67
        $message
68
            ->expects($this->any())
69
            ->method('isMultipart')
70
            ->will($this->returnValue(false));
71
72
        $message
73
            ->expects($this->any())
74
            ->method('getContent')
75
            ->will($this->returnValue($this->messages[$messageId]['plainText']));
76
77
        $message
78
            ->expects($this->any())
79
            ->method('getHeaderField')
80
            ->will($this->returnValue('text/plain'))
81
            ->with($this->equalTo('Content-Type'));
82
83
        return $message;
84
    }
85
86
    /**
87
     * This test is only for validating correct decoding of the message (subject/plaintext/received)
88
     */
89
    public function testMailParse()
90
    {
91
        $imapAdapter = $this->createImapAdapter();
92
93
        /** @var \PHPUnit_Framework_MockObject_MockObject|ImapExtension $imapExtension */
94
        $imapExtension = $imapAdapter->getInstance();
95
96
        $imapExtension
97
            ->expects($this->any())
98
            ->method('search')
99
            ->will($this->returnValue([0]));
100
101
        $imapExtension
102
            ->expects($this->any())
103
            ->method('getMessage')
104
            ->will($this->returnValue($this->createImapRawMessage(
105
                base64_decode(file_get_contents(__DIR__.'/data/messages/raw/multipart'))
106
            )));
107
108
        $messages = $this->imapHelper->fetchMails($imapAdapter, null, true, true);
109
        $message = $messages[0];
110
111
        $this->assertEquals('ORDER #12345678 - CONFIRMATION', $message['subject']);
112
        $this->assertEquals(1404914391, $message['received']);
113
        $this->assertEquals('test'.chr(10).chr(10), $message['plainText']);
114
    }
115
116
    /**
117
     * This test is only for validating correct decoding of the attachments
118
     */
119
    public function testMailAttachmentParse()
120
    {
121
        $imapAdapter = $this->createImapAdapter();
122
123
        /** @var \PHPUnit_Framework_MockObject_MockObject|ImapExtension $imapExtension */
124
        $imapExtension = $imapAdapter->getInstance();
125
126
        $imapExtension
127
            ->expects($this->any())
128
            ->method('search')
129
            ->will($this->returnValue([0]));
130
131
        $imapExtension
132
            ->expects($this->any())
133
            ->method('getMessage')
134
            ->will($this->returnValue($this->createImapRawMessage(
135
                base64_decode(file_get_contents(__DIR__.'/data/messages/raw/with-attachment'))
136
            )));
137
138
        $messages = $this->imapHelper->fetchMails($imapAdapter, null, true, true);
139
        $attachment = $messages[0]['attachments'][0];
140
141
        $this->assertEquals('application/x-zip-compressed', $attachment['mime']);
142
        $this->assertEquals('finaltest_tobias-nitsche_de.zip', $attachment['filename']);
143
        $this->assertEquals(3962, strlen($attachment['content']));
144
    }
145
146
    /**
147
     * test for assuming domain names and ordernumbersof email
148
     */
149
    public function testMailAssume()
150
    {
151
        $asserts = array_map(function ($message) {
152
            static $i = 0;
153
154
            return [
155
                'id'          => $i++,
156
                'folder'      => 'INBOX',
157
                'subject'     => $message['subject'],
158
                'received'    => strtotime($message['date']),
159
                'plainText'   => $message['plainText'],
160
                'attachments' => null,
161
                'type'        => $message['type'],
162
                'domainName'  => $message['domainName'],
163
                'orderNumber' => $message['orderNumber'],
164
            ];
165
        }, $this->messages);
166
167
        $imapAdapter = $this->createImapAdapter();
168
169
        $imapAdapter
170
            ->expects($this->any())
171
            ->method('search')
172
            ->will($this->returnValue(array_keys($this->messages)));
173
174
        $imapAdapter
175
            ->expects($this->any())
176
            ->method('getMessage')
177
            ->will($this->returnCallback(function ($id) {
178
                return $this->createImapStorageMessage($id);
179
            }));
180
181
182
        $messages = $this->imapHelper->fetchMails($imapAdapter, [], true, true);
0 ignored issues
show
array() is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
183
184
        $this->assertEquals($asserts, $messages);
185
    }
186
187
    /**
188
     * @param string $raw
189
     *
190
     * @return Message
191
     */
192
    protected function createImapRawMessage($raw)
193
    {
194
        return new Message(['raw' => $raw]);
195
    }
196
}
197