Issues (83)

Security Analysis    not enabled

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/Receiver/MiscellaneousTest.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 FlexyProject\GitHub\Tests\Receiver;
3
4
use FlexyProject\GitHub\{
5
    Client, Receiver\Miscellaneous, Tests\AbstractClientTest
6
};
7
8
/**
9
 * Class MiscellaneousTest
10
 *
11
 * @package FlexyProject\GitHub\Tests
12
 */
13
class MiscellaneousTest extends AbstractClientTest
14
{
15
16
    /** @var Miscellaneous */
17
    protected $miscellaneous;
18
19
    /** @var Miscellaneous\Emojis */
20
    protected $emojis;
21
22
    /** @var  Miscellaneous\Gitignore */
23
    protected $gitIgnore;
24
25
    /** @var  Miscellaneous\Licenses */
26
    protected $licenses;
27
28
    /** @var  Miscellaneous\Markdown */
29
    protected $markdown;
30
31
    /** @var  Miscellaneous\Meta */
32
    protected $meta;
33
34
    /** @var  Miscellaneous\RateLimit */
35
    protected $rateLimit;
36
37
    /**
38
     * MiscellaneousTest constructor.
39
     *
40
     * @param null   $name
41
     * @param array  $data
42
     * @param string $dataName
43
     */
44
    public function __construct($name = null, array $data = [], $dataName = '')
45
    {
46
        parent::__construct($name, $data, $dataName);
47
48
        // Miscellaneous
49
        $this->miscellaneous = $this->client->getReceiver(Client::MISCELLANEOUS);
50
51
        // Emojis
52
        $this->emojis = $this->miscellaneous->getReceiver(Miscellaneous::EMOJIS);
53
54
        // GitIgnore
55
        $this->gitIgnore = $this->miscellaneous->getReceiver(Miscellaneous::GITIGNORE);
56
57
        // Licenses
58
        $this->licenses = $this->miscellaneous->getReceiver(Miscellaneous::LICENSES);
59
60
        // Markdown
61
        $this->markdown = $this->miscellaneous->getReceiver(Miscellaneous::MARKDOWN);
62
63
        // Meta
64
        $this->meta = $this->miscellaneous->getReceiver(Miscellaneous::META);
65
66
        // RateLimit
67
        $this->rateLimit = $this->miscellaneous->getReceiver(Miscellaneous::RATE_LIMIT);
68
    }
69
70
    /**
71
     * Test instance of Miscellaneous's class
72
     */
73
    public function testMiscellaneous()
74
    {
75
        $this->assertInstanceOf(Miscellaneous::class, $this->miscellaneous);
76
    }
77
78
    /**
79
     * Test instance of Emojis's class
80
     */
81
    public function testEmojis()
82
    {
83
        $this->assertInstanceOf(Miscellaneous\Emojis::class, $this->emojis);
84
    }
85
86
    /**
87
     * Test instance of Gitignore's class
88
     */
89
    public function testGitIgnore()
90
    {
91
        $this->assertInstanceOf(Miscellaneous\Gitignore::class, $this->gitIgnore);
92
    }
93
94
    /**
95
     * Test instance of Licenses's class
96
     */
97
    public function testLicenses()
98
    {
99
        $this->assertInstanceOf(Miscellaneous\Licenses::class, $this->licenses);
100
    }
101
102
    /**
103
     * Test instance of Markdown's class
104
     */
105
    public function testMarkdown()
106
    {
107
        $this->assertInstanceOf(Miscellaneous\Markdown::class, $this->markdown);
108
    }
109
110
    /**
111
     * Test instance of Meta's class
112
     */
113
    public function testMeta()
114
    {
115
        $this->assertInstanceOf(Miscellaneous\Meta::class, $this->meta);
116
    }
117
118
    /**
119
     * Test instance of 's class
120
     */
121
    public function testRateLimit()
122
    {
123
        $this->assertInstanceOf(Miscellaneous\RateLimit::class, $this->rateLimit);
124
    }
125
126
    /**
127
     * Test list available Emojis
128
     */
129
    public function testGetListEmojis()
130
    {
131
        $this->assertCount(1508, $this->emojis->get());
132
    }
133
134
    /**
135
     * Test listing available templates
136
     */
137
    public function testListingAvailableTemplates()
138
    {
139
        $templates = $this->gitIgnore->listingAvailableTemplates();
140
141
        $this->assertContains('Android', $templates);
142
    }
143
144
    /**
145
     * Test getting a single template
146
     */
147
    public function testGetSingleTemplate()
148
    {
149
        $template = $this->gitIgnore->getSingleTemplate('Android');
150
151
        $this->assertArrayHasKey('name', $template);
152
        $this->assertArrayHasKey('source', $template);
153
    }
154
155
    /**
156
     * Test listing all licenses
157
     */
158
    public function testListAllLicenses()
159
    {
160
        $licenses = $this->licenses->listAllLicenses();
161
        $license  = array_pop($licenses);
162
163
        $this->assertArrayHasKey('key', $license);
164
        $this->assertArrayHasKey('name', $license);
165
        $this->assertArrayHasKey('spdx_id', $license);
166
        $this->assertArrayHasKey('url', $license);
167
        $this->assertArrayHasKey('featured', $license);
168
    }
169
170
    /**
171
     * Test getting individual license
172
     */
173
    public function testGettingIndividualLicense()
174
    {
175
        $license = $this->licenses->getIndividualLicense('mit');
176
177
        $this->assertArrayHasKey('body', $license);
178
    }
179
180
    /**
181
     * Test render markdown text
182
     */
183 View Code Duplication
    public function testRender()
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...
184
    {
185
        $output = $this->markdown->render('Hello world FlexyProject/GitHubAPI#43 **cool**, and #43!');
186
187
        $this->assertEquals('<p>Hello world FlexyProject/GitHubAPI#43 <strong>cool</strong>, and #43!</p>',
188
            str_replace(["\r\n", "\r", "\n"], "", $output[0]));
189
    }
190
191
    /**
192
     * Test render markdown raw text
193
     */
194 View Code Duplication
    public function testRenderRaw()
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...
195
    {
196
        $output = $this->markdown->renderRaw('**cool**');
197
198
        $this->assertEquals('<p>{"file":"<strong>cool</strong>"}</p>',
199
            str_replace(["\r\n", "\r", "\n"], "", $output[0]));
200
    }
201
202
    /**
203
     * Test getting meta about GitHub.com
204
     */
205
    public function testGetMeta()
206
    {
207
        $meta = $this->meta->get();
208
209
        $this->assertTrue($meta['verifiable_password_authentication']);
210
    }
211
212
    /**
213
     * Test rate limit
214
     */
215
    public function testRate()
216
    {
217
        $rateLimit = $this->rateLimit->get();
218
219
        $this->assertArrayHasKey('rate', $rateLimit);
220
    }
221
}