Issues (1751)

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

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
class psiteUrlSaveTtest extends AriadneBaseTest
4
{
5
6
	static protected $testPath;
7
8
	public function setUp()
9
	{
10
		$this->initAriadne();
11
	}
12
13
	public static function setUpBeforeClass()
14
	{
15
		self::initAriadne();
16
		parent::setUpBeforeClass();
17
		$args = array (
18
			'arNewType' => 'psite',
19
			'arNewFilename' => '{5:id}',
20
			'nl' => array (
21
				'name' => 'testsite nl',
22
			),
23
			'en' => array (
24
				'name' => 'testsite en',
25
			),
26
			'de' => array (
27
				'name' => 'testsite de',
28
			)
29
		);
30
31
		self::$testPath = current(ar::get(TESTBASE)->call('system.new.phtml' , $args));
32
	}
33
34
	public function testWithoutURL(){
35
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
36
37
		$testobj->call('system.save.data.phtml',array());
38
		$this->assertFalse((bool)$testobj->error);
39
40
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
41
42
		$this->assertEquals($testobj->data->url, $refobj->data->url);
43
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
44
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
45
46
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
47
		$this->assertEmpty($refobj->data->config->url_list['host']);
48
49
		$this->assertArrayHasKey('nls', $refobj->data->config->url_list);
50
51
	}
52
53
	public function testNoNlsUpgrade(){
54
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
55
		$testobj->data->url = 'http://test.url/';
56
57
		// unset structure
58
		unset($testobj->data->urlList);
59
		unset($testobj->data->en->url);
60
		unset($testobj->data->de->url);
61
		unset($testobj->data->nl->url);
62
		unset($testobj->data->en->urlList);
63
		unset($testobj->data->de->urlList);
64
		unset($testobj->data->nl->urlList);
65
		$testobj->save();
66
67
		// renew testobject
68
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
69
		$testobj->call('system.save.data.phtml',array());
70
		$this->assertFalse((bool)$testobj->error);
71
72
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
73
		$this->assertEquals($testobj->data->url, 'http://test.url/');
74
		$this->assertEquals($testobj->data->url, $refobj->data->url);
75
76
		$this->assertContains('http://test.url/', $refobj->data->en->urlList);
77
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
78
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
79
		$this->assertEmpty($testobj->data->nl->urlList);
80
		$this->assertEmpty($testobj->data->de->urlList);
81
		$this->assertEquals('', $testobj->data->nl->url);
82
		$this->assertEquals('', $testobj->data->de->url);
83
84
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
85
		$this->assertArrayHasKey('test.url', $refobj->data->config->url_list['host']);
86
	}
87
88
	public function testMultiNlsUpgrade(){
89
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
90
91
		// test data
92
		$testobj->data->en->url = 'http://test.url.en';
93
		$testobj->data->de->url = 'http://test.url.de';
94
		$testobj->data->nl->url = 'http://test.url.nl';
95
96
		// unset structure
97
		unset($testobj->data->url);
98
		unset($testobj->data->en->urlList);
99
		unset($testobj->data->de->urlList);
100
		unset($testobj->data->nl->urlList);
101
		$testobj->save();
102
103
		// renew testobject
104
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
105
		$testobj->call('system.save.data.phtml',array());
106
		$this->assertFalse((bool)$testobj->error);
107
108
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
109
		$this->assertEquals($testobj->data->url, 'http://test.url.en');
110
		$this->assertEquals($testobj->data->en->url, 'http://test.url.en');
111
		$this->assertEquals($testobj->data->nl->url, 'http://test.url.nl');
112
		$this->assertEquals($testobj->data->de->url, 'http://test.url.de');
113
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
114
		$this->assertEquals($testobj->data->nl->url, $refobj->data->nl->url);
115
		$this->assertEquals($testobj->data->de->url, $refobj->data->de->url);
116
117
		$this->assertContains('http://test.url.en', $refobj->data->en->urlList);
118
		$this->assertContains('http://test.url.nl', $refobj->data->nl->urlList);
119
		$this->assertContains('http://test.url.de', $refobj->data->de->urlList);
120
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
121
		$this->assertEquals($testobj->data->nl->url, $refobj->data->nl->url);
122
		$this->assertEquals($testobj->data->de->url, $refobj->data->de->url);
123
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
124
		$this->assertEquals($testobj->data->nl->urlList, $refobj->data->nl->urlList);
125
		$this->assertEquals($testobj->data->de->urlList, $refobj->data->de->urlList);
126
127
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
128
		$this->assertArrayHasKey('test.url.en', $refobj->data->config->url_list['host']);
129
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
130
		$this->assertArrayHasKey('test.url.de', $refobj->data->config->url_list['host']);
131
		$this->assertEquals('en', $refobj->data->config->url_list['host']['test.url.en']);
132
		$this->assertEquals('nl', $refobj->data->config->url_list['host']['test.url.nl']);
133
		$this->assertEquals('de', $refobj->data->config->url_list['host']['test.url.de']);
134
	}
135
136
	public function testApiNoNLS(){
137
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
138
139
		// unset structure
140
		unset($testobj->data->url);
141
		unset($testobj->data->urlList);
142
		unset($testobj->data->en->url);
143
		unset($testobj->data->de->url);
144
		unset($testobj->data->nl->url);
145
		unset($testobj->data->en->urlList);
146
		unset($testobj->data->de->urlList);
147
		unset($testobj->data->nl->urlList);
148
		$testobj->save();
149
150
		$testobj->call('system.save.data.phtml',array(
151
			'url' => 'http://test.url'
152
		));
153
		$this->assertFalse((bool)$testobj->error);
154
155
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
156
		$this->assertEquals($testobj->data->url, 'http://test.url');
157
		$this->assertEquals($testobj->data->url, $refobj->data->url);
158
159
		$this->assertContains('http://test.url', $refobj->data->en->urlList);
160
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
161
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
162
		$this->assertEmpty($testobj->data->nl->urlList);
163
		$this->assertEmpty($testobj->data->de->urlList);
164
		$this->assertEquals('', $testobj->data->nl->url);
165
		$this->assertEquals('', $testobj->data->de->url);
166
167
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
168
		$this->assertArrayHasKey('test.url', $refobj->data->config->url_list['host']);
169
170
		$testobj->call('system.save.data.phtml',array(
171
			'url' => ''
172
		));
173
		$this->assertFalse((bool)$testobj->error);
174
175
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
176
		$this->assertEquals($testobj->data->url, '');
177
		$this->assertEquals($testobj->data->url, $refobj->data->url);
178
179
		$this->assertEmpty($refobj->data->en->urlList);
180
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
181
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
182
		$this->assertEmpty($testobj->data->nl->urlList);
183
		$this->assertEmpty($testobj->data->de->urlList);
184
		$this->assertEquals('', $testobj->data->nl->url);
185
		$this->assertEquals('', $testobj->data->de->url);
186
187
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
188
		$this->assertArrayNotHasKey('test.url', $refobj->data->config->url_list['host']);
189
190
	}
191
192
	public function testApiNLS(){
193
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
194
195
		// unset structure
196
		unset($testobj->data->url);
197
		unset($testobj->data->urlList);
198
		unset($testobj->data->en->url);
199
		unset($testobj->data->de->url);
200
		unset($testobj->data->nl->url);
201
		unset($testobj->data->en->urlList);
202
		unset($testobj->data->de->urlList);
203
		unset($testobj->data->nl->urlList);
204
		$testobj->save();
205
206
		$testobj->call('system.save.data.phtml',array(
207
			'en' => array (
208
				'url' => 'http://test.url.en'
209
			),
210
			'nl' => array (
211
				'url' => 'http://test.url.nl'
212
			)
213
		));
214
		$this->assertFalse((bool)$testobj->error);
215
216
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
217
		$this->assertEquals($testobj->data->url, 'http://test.url.en');
218
		$this->assertEquals($testobj->data->en->url, 'http://test.url.en');
219
		$this->assertEquals($testobj->data->nl->url, 'http://test.url.nl');
220
		$this->assertEquals($testobj->data->url, $refobj->data->url);
221
222
		$this->assertContains('http://test.url.en', $refobj->data->en->urlList);
223
		$this->assertContains('http://test.url.nl', $refobj->data->nl->urlList);
224
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
225
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
226
		$this->assertEmpty($testobj->data->de->urlList);
227
		$this->assertEquals('', $testobj->data->de->url);
228
229
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
230
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
231
232
		$testobj->call('system.save.data.phtml',array(
233
			'nl' => array (
234
				'url' => 'http://test2.url.nl'
235
			)
236
		));
237
		$this->assertFalse((bool)$testobj->error);
238
239
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
240
		$this->assertEquals($testobj->data->url, 'http://test.url.en');
241
		$this->assertEquals($testobj->data->en->url, 'http://test.url.en');
242
		$this->assertEquals($testobj->data->nl->url, 'http://test2.url.nl');
243
		$this->assertEquals($testobj->data->url, $refobj->data->url);
244
		$this->assertEquals($testobj->data->nl->url, $refobj->data->nl->url);
245
246
		$this->assertContains('http://test.url.en', $refobj->data->en->urlList);
247
		$this->assertContains('http://test.url.nl', $refobj->data->nl->urlList);
248
		$this->assertContains('http://test2.url.nl', $refobj->data->nl->urlList);
249
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
250
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
251
		$this->assertEmpty($testobj->data->de->urlList);
252
		$this->assertEquals('', $testobj->data->de->url);
253
254
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
255
		$this->assertArrayHasKey('test2.url.nl', $refobj->data->config->url_list['host']);
256
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
257
		$this->assertArrayHasKey('test.url.en', $refobj->data->config->url_list['host']);
258
259
		$testobj->call('system.save.data.phtml',array(
260
			'nl' => array (
261
				'url' => 'http://test.url.nl'
262
			)
263
		));
264
		$this->assertFalse((bool)$testobj->error);
265
266
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
267
		$this->assertEquals($testobj->data->en->url, 'http://test.url.en');
268
		$this->assertEquals($testobj->data->nl->url, 'http://test.url.nl');
269
		$this->assertEquals($testobj->data->nl->url, $refobj->data->nl->url);
270
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
271
272
		$this->assertContains('http://test.url.nl', $refobj->data->nl->urlList);
273
		$this->assertContains('http://test2.url.nl', $refobj->data->nl->urlList);
274
		$this->assertEquals($testobj->data->nl->urlList, $refobj->data->nl->urlList);
275
		$this->assertEmpty($testobj->data->de->urlList);
276
		$this->assertEquals('', $testobj->data->de->url);
277
278
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
279
		$this->assertArrayHasKey('test2.url.nl', $refobj->data->config->url_list['host']);
280
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
281
		$this->assertArrayHasKey('test.url.en', $refobj->data->config->url_list['host']);
282
283
		$testobj->call('system.save.data.phtml',array(
284
			'en' => array (
285
				'url' => ''
286
			),
287
			'nl' => array (
288
				'url' => ''
289
			)
290
		));
291
292
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
293
		$this->assertEquals($testobj->data->url, '');
294
		$this->assertEquals($testobj->data->nl->url, '');
295
		$this->assertEquals($testobj->data->en->url, '');
296
		$this->assertEquals($testobj->data->url, $refobj->data->url);
297
298
		$this->assertEmpty($refobj->data->en->urlList);
299
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
300
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
301
		$this->assertEmpty($testobj->data->nl->urlList);
302
		$this->assertEmpty($testobj->data->de->urlList);
303
		$this->assertEquals('', $testobj->data->nl->url);
304
		$this->assertEquals('', $testobj->data->de->url);
305
306
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
307
		$this->assertArrayNotHasKey('test.url.nl', $refobj->data->config->url_list['host']);
308
		$this->assertArrayNotHasKey('test2.url.nl', $refobj->data->config->url_list['host']);
309
		$this->assertArrayNotHasKey('test.url.en', $refobj->data->config->url_list['host']);
310
311
	}
312
313
	public function testApiMultiUrlList(){
314
		$testobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
315
316
		// unset structure
317
		unset($testobj->data->url);
318
		unset($testobj->data->urlList);
319
		unset($testobj->data->en->url);
320
		unset($testobj->data->de->url);
321
		unset($testobj->data->nl->url);
322
		unset($testobj->data->en->urlList);
323
		unset($testobj->data->de->urlList);
324
		unset($testobj->data->nl->urlList);
325
		$testobj->save();
326
327
		$testobj->call('system.save.data.phtml',array(
328
			'en' => array (
329
				'urlList' => array (
330
					'http://test.url.en',
331
					)
332
			),
333
			'nl' => array (
334
				'urlList' => array (
335
					'http://test.url.nl',
336
					'http://test2.url.nl'
337
				)
338
			)
339
		));
340
		$this->assertFalse((bool)$testobj->error);
341
342
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
343
		$this->assertEquals($testobj->data->url, 'http://test.url.en');
344
		$this->assertEquals($testobj->data->en->url, 'http://test.url.en');
345
		$this->assertEquals($testobj->data->nl->url, 'http://test.url.nl');
346
		$this->assertEquals($testobj->data->url, $refobj->data->url);
347
348
		$this->assertContains('http://test.url.en', $refobj->data->en->urlList);
349
		$this->assertContains('http://test.url.nl', $refobj->data->nl->urlList);
350
		$this->assertContains('http://test2.url.nl', $refobj->data->nl->urlList);
351
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
352
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
353
		$this->assertEquals($testobj->data->nl->url, $refobj->data->nl->url);
354
		$this->assertEquals($testobj->data->nl->urlList, $refobj->data->nl->urlList);
355
		$this->assertEmpty($testobj->data->de->urlList);
356
		$this->assertEquals('', $testobj->data->de->url);
357
358
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
359
		$this->assertArrayHasKey('test.url.en', $refobj->data->config->url_list['host']);
360
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
361
		$this->assertArrayHasKey('test2.url.nl', $refobj->data->config->url_list['host']);
362
363
		$testobj->call('system.save.data.phtml',array(
364
			'en' => array (
365
				'urlList' => ''
366
			)
367
		));
368
369
		$refobj = current(ar::get(self::$testPath)->call('system.get.phtml'));
370
		$this->assertEquals($testobj->data->url, '');
371
		$this->assertEquals($testobj->data->nl->url, 'http://test.url.nl');
372
		$this->assertEquals($testobj->data->en->url, '');
373
		$this->assertEquals($testobj->data->url, $refobj->data->url);
374
375
		$this->assertEmpty($refobj->data->en->urlList);
376
		$this->assertEquals($testobj->data->en->url, $refobj->data->en->url);
377
		$this->assertEquals($testobj->data->en->urlList, $refobj->data->en->urlList);
378
		$this->assertEmpty($testobj->data->de->urlList);
379
		$this->assertEquals('', $testobj->data->de->url);
380
381
		$this->assertArrayHasKey('host', $refobj->data->config->url_list);
382
		$this->assertArrayHasKey('test.url.nl', $refobj->data->config->url_list['host']);
383
		$this->assertArrayHasKey('test2.url.nl', $refobj->data->config->url_list['host']);
384
		$this->assertArrayNotHasKey('test.url.en', $refobj->data->config->url_list['host']);
385
	}
386
}
387
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
388