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/Controller/CommentTest.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
namespace Redaxscript\Tests\Controller;
3
4
use Redaxscript\Controller;
5
use Redaxscript\Db;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * CommentTest
10
 *
11
 * @since 3.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 * @author Balázs Szilágyi
17
 *
18
 * @covers Redaxscript\Controller\Comment
19
 * @covers Redaxscript\Controller\ControllerAbstract
20
 *
21
 * @requires OS Linux
22
 */
23
24
class CommentTest extends TestCaseAbstract
25
{
26
	/**
27
	 * setUp
28
	 *
29
	 * @since 3.1.0
30
	 */
31
32
	public function setUp() : void
33
	{
34
		parent::setUp();
35
		$optionArray = $this->getOptionArray();
36
		$installer = $this->installerFactory();
37
		$installer->init();
38
		$installer->rawCreate();
39
		$installer->insertSettings($optionArray);
40
		Db::forTablePrefix('articles')
41
			->create()
42
			->set(
43
			[
44
				'title' => 'Article One',
45
				'alias' => 'article-one'
46
47
			])
48
			->save();
49
		$setting = $this->settingFactory();
50
		$setting->set('captcha', 1);
51
	}
52
53
	/**
54
	 * tearDown
55
	 *
56
	 * @since 3.1.0
57
	 */
58
59
	public function tearDown() : void
60
	{
61
		$this->dropDatabase();
62
	}
63
64
	/**
65
	 * testProcess
66
	 *
67
	 * @since 3.0.0
68
	 *
69
	 * @param array $postArray
70
	 * @param array $settingArray
71
	 * @param string $method
72
	 * @param string $expect
73
	 *
74
	 * @dataProvider providerAutoloader
75
	 */
76
77
	public function testProcess(array $postArray = [], array $settingArray = [], string $method = null, string $expect = null) : void
78
	{
79
		/* setup */
80
81
		$this->_request->set('post', $postArray);
82
		$setting = $this->settingFactory();
83
		$setting->set('notification', $settingArray['notification']);
84
		$setting->set('moderation', $settingArray['moderation']);
85
		if ($method)
0 ignored issues
show
Bug Best Practice introduced by
The expression $method of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
86
		{
87
			$commentController = $this
88
				->getMockBuilder('Redaxscript\Controller\Comment')
89
				->setConstructorArgs(
90
				[
91
					$this->_registry,
92
					$this->_request,
93
					$this->_language,
94
					$this->_config
95
				])
96
				->setMethods(
97
				[
98
					$method
99
				])
100
				->getMock();
101
102
			/* override */
103
104
			$commentController
105
				->expects($this->any())
106
				->method($method);
107
		}
108
		else
109
		{
110
			$commentController = new Controller\Comment($this->_registry, $this->_request, $this->_language, $this->_config);
111
		}
112
113
		/* actual */
114
115
		$actual = $commentController->process();
116
117
		/* compare */
118
119
		$this->assertEquals($expect, $actual);
120
	}
121
}
122