Issues (201)

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/unit/TestCaseAbstract.php (1 issue)

Labels
Severity

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 Redaxscript\Tests;
3
4
use PHPUnitProviderAutoloader;
5
use Redaxscript\Config;
6
use Redaxscript\Db;
7
use Redaxscript\Installer;
8
use Redaxscript\Language;
9
use Redaxscript\Model;
10
use Redaxscript\Modules\TestDummy;
11
use Redaxscript\Registry;
12
use Redaxscript\Request;
13
use ReflectionClass;
14
use function chr;
15
use function file_exists;
16
use function file_get_contents;
17
use function function_exists;
18
use function json_decode;
19
use function str_replace;
20
use function xdebug_get_headers;
21
22
/**
23
 * TestCaseAbstract
24
 *
25
 * @since 2.2.0
26
 *
27
 * @package Redaxscript
28
 * @category Tests
29
 * @author Henry Ruhs
30
 */
31
32
abstract class TestCaseAbstract extends PHPUnitProviderAutoloader\TestCaseAbstract
33
{
34
	/**
35
	 * instance of the registry class
36
	 *
37
	 * @var Registry
38
	 */
39
40
	protected Registry $_registry;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
41
42
	/**
43
	 * instance of the request class
44
	 *
45
	 * @var Request
46
	 */
47
48
	protected Request $_request;
49
50
	/**
51
	 * instance of the language class
52
	 *
53
	 * @var Language
54
	 */
55
56
	protected Language $_language;
57
58
	/**
59
	 * instance of the config class
60
	 *
61
	 * @var Config
62
	 */
63
64
	protected Config $_config;
65
66
	/**
67
	 * directory of the provider
68
	 *
69
	 * @var string
70
	 */
71
72
	protected $_providerDirectory = 'tests' . DIRECTORY_SEPARATOR . 'unit-provider';
73
74
	/**
75
	 * namespace of the testing suite
76
	 *
77
	 * @var string
78
	 */
79
80
	protected $_testNamespace = __NAMESPACE__;
81
82
	/**
83
	 * setUp
84
	 *
85
	 * @since 3.1.0
86
	 */
87
88
	public function setUp() : void
89
	{
90
		Db::clearCache();
91
		$this->_registry = Registry::getInstance();
92
		$this->_request = Request::getInstance();
93
		$this->_language = Language::getInstance();
94
		$this->_config = Config::getInstance();
95
	}
96
97
	/**
98
	 * installerFactory
99
	 *
100
	 * @since 3.1.0
101
	 *
102
	 * @return Installer
103
	 */
104
105
	public function installerFactory() : Installer
106
	{
107
		return new Installer($this->_registry, $this->_request, $this->_language, $this->_config);
108
	}
109
110
	/**
111
	 * settingFactory
112
	 *
113
	 * @since 3.3.0
114
	 *
115
	 * @return Model\Setting
116
	 */
117
118
	public function settingFactory() : Model\Setting
119
	{
120
		return new Model\Setting();
121
	}
122
123
	/**
124
	 * createDatabase
125
	 *
126
	 * @since 4.0.0
127
	 */
128
129
	public function createDatabase() : void
130
	{
131
		$installer = $this->installerFactory();
132
		$installer->init();
133
		$installer->rawCreate();
134
	}
135
136
	/**
137
	 * dropDatabase
138
	 *
139
	 * @since 4.0.0
140
	 */
141
142
	public function dropDatabase() : void
143
	{
144
		$installer = $this->installerFactory();
145
		$installer->init();
146
		$installer->rawDrop();
147
	}
148
	/**
149
	 * getOptionArray
150
	 *
151
	 * @since 4.1.0
152
	 */
153
154
	public function getOptionArray() : array
155
	{
156
		return
157
		[
158
			'adminName' => 'Test',
159
			'adminUser' => 'test',
160
			'adminPassword' => 'aaAA00AAaa',
161
			'adminEmail' => '[email protected]'
162
		];
163
	}
164
165
	/**
166
	 * installTestDummy
167
	 *
168
	 * @since 4.0.0
169
	 */
170
171
	public function installTestDummy() : void
172
	{
173
		$testDummy = new TestDummy\TestDummy($this->_registry, $this->_request, $this->_language, $this->_config);
174
		$testDummy->install();
175
	}
176
177
	/**
178
	 * uninstallTestDummy
179
	 *
180
	 * @since 4.0.0
181
	 */
182
183
	public function uninstallTestDummy() : void
184
	{
185
		$testDummy = new TestDummy\TestDummy($this->_registry, $this->_request, $this->_language, $this->_config);
186
		$testDummy->clearNotification('success');
187
		$testDummy->clearNotification('warning');
188
		$testDummy->clearNotification('error');
189
		$testDummy->clearNotification('info');
190
		$testDummy->uninstall();
191
	}
192
193
	/**
194
	 * getJSON
195
	 *
196
	 * @since 4.0.0
197
	 *
198
	 * @param string $file
199
	 *
200
	 * @return array|null
201
	 */
202
203
	public function getJSON(string $file = null) : ?array
204
	{
205
		if (file_exists($file))
206
		{
207
			$content = file_get_contents($file);
208
			return json_decode($content, true);
209
		}
210
	}
211
212
	/**
213
	 * getProperty
214
	 *
215
	 * @since 3.0.0
216
	 *
217
	 * @param object $object
218
	 * @param string $property
219
	 *
220
	 * @return array|object
221
	 */
222
223
	public function getProperty(object $object = null, string $property = null)
224
	{
225
		$reflection = new ReflectionClass($object);
226
		$reflectionProperty = $reflection->getProperty($property);
227
		$reflectionProperty->setAccessible(true);
228
		return $reflectionProperty->getValue($object);
229
	}
230
231
	/**
232
	 * callMethod
233
	 *
234
	 * @since 3.0.0
235
	 *
236
	 * @param object $object
237
	 * @param string $method
238
	 * @param array $argumentArray
239
	 *
240
	 * @return array|object
241
	 */
242
243
	public function callMethod(object $object = null, string $method = null, array $argumentArray = [])
244
	{
245
		$reflection = new ReflectionClass($object);
246
		$reflectionMethod = $reflection->getMethod($method);
247
		$reflectionMethod->setAccessible(true);
248
		return $reflectionMethod->invokeArgs($object, $argumentArray);
249
	}
250
251
	/**
252
	 * normalizeSeparator
253
	 *
254
	 * @since 3.2.0
255
	 *
256
	 * @param string $actual
257
	 *
258
	 * @return string
259
	 */
260
261
	public function normalizeSeparator(string $actual = null) : string
262
	{
263
		return str_replace(DIRECTORY_SEPARATOR, chr(47), $actual);
264
	}
265
266
	/**
267
	 * normalizeNewline
268
	 *
269
	 * @since 3.0.0
270
	 *
271
	 * @param string $actual
272
	 *
273
	 * @return string
274
	 */
275
276
	public function normalizeNewline(string $actual = null) : string
277
	{
278
		return str_replace(PHP_EOL, chr(10), $actual);
279
	}
280
281
	/**
282
	 * getHeaderArray
283
	 *
284
	 * @since 3.0.0
285
	 *
286
	 * @return array|null
287
	 */
288
289
	public function getHeaderArray() : ?array
290
	{
291
		if (function_exists('xdebug_get_headers'))
292
		{
293
			return xdebug_get_headers();
294
		}
295
		$this->markTestSkipped();
296
		return null;
297
	}
298
}
299