Issues (3882)

Security Analysis    39 potential vulnerabilities

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting (9)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (2)
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.
  File Exposure (7)
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.
  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.
  Code Injection (13)
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  Cross-Site Scripting (8)
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.
  Header Injection
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/GuiBase.php (4 issues)

1
<?php
2
/**
3
 * Base test class.
4
 *
5
 * @package   Tests
6
 *
7
 * @see https://github.com/php-webdriver/php-webdriver
8
 *
9
 * @copyright YetiForce S.A.
10
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
11
 * @author    Mariusz Krzaczkowski <[email protected]>
12
 */
13
14
namespace tests;
15
16
use Facebook\WebDriver\Remote\DesiredCapabilities;
0 ignored issues
show
The type Facebook\WebDriver\Remote\DesiredCapabilities was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Facebook\WebDriver\Remote\RemoteWebDriver;
0 ignored issues
show
The type Facebook\WebDriver\Remote\RemoteWebDriver was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Facebook\WebDriver\WebDriverBy;
0 ignored issues
show
The type Facebook\WebDriver\WebDriverBy was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use PHPUnit\Framework\TestCase;
0 ignored issues
show
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
abstract class GuiBase extends TestCase
22
{
23
	/** @var mixed Last logs. */
24
	public $logs;
25
26
	/** @var \Facebook\WebDriver\Remote\RemoteWebDriver Web driver. */
27
	protected $driver;
28
29
	/** @var bool Is login */
30
	protected $isLogin = false;
31
32
	/**
33
	 * Not success test.
34
	 *
35
	 * @codeCoverageIgnore
36
	 *
37
	 * @param \Throwable $t
38
	 *
39
	 * @return void
40
	 */
41
	protected function onNotSuccessfulTest(\Throwable $t): void
42
	{
43
		if (isset($this->logs)) {
44
			echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  LOGS:\n";
45
			\print_r($this->logs);
46
			\print_r($t);
47
			file_put_contents(ROOT_DIRECTORY . '/cache/logs/selenium_logs.log', print_r($this->logs, true));
48
		}
49
		echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
50
		print_r($t->__toString());
51
		echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
52
		if (null !== $this->driver) {
53
			file_put_contents(ROOT_DIRECTORY . '/cache/logs/selenium_source.html', $this->driver->getPageSource());
54
			echo 'URL: ';
55
			$this->driver->getCurrentURL();
56
			echo PHP_EOL;
57
			echo 'Title: ';
58
			$this->driver->getTitle();
59
			echo PHP_EOL;
60
			echo 'Browser logs: ';
61
			print_r($this->driver->manage()->getLog('browser'));
62
			$this->driver->takeScreenshot(ROOT_DIRECTORY . '/cache/logs/selenium_screenshot.png');
63
		} else {
64
			echo 'No $this->driver';
65
		}
66
		echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
67
		throw $t;
68
	}
69
70
	/**
71
	 * Setup test.
72
	 *
73
	 * @return void
74
	 */
75
	protected function setUp(): void
76
	{
77
		parent::setUp();
78
		if (empty($this->driver)) {
79
			$capabilities = DesiredCapabilities::chrome();
80
			$capabilities->setCapability('chromeOptions', ['args' => ['headless', 'disable-dev-shm-usage', 'no-sandbox']]);
81
			$this->driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities, 60000, 60000);
82
		}
83
		if (!$this->isLogin) {
84
			$this->login();
85
		}
86
	}
87
88
	/**
89
	 * Go to URL.
90
	 *
91
	 * @param string $url
92
	 *
93
	 * @throws \ReflectionException
94
	 *
95
	 * @return void
96
	 */
97
	public function url(string $url): void
98
	{
99
		$this->driver->get(\App\Config::main('site_URL') . $url);
100
	}
101
102
	/**
103
	 * Testing login page display.
104
	 *
105
	 * @return void
106
	 */
107
	public function login(): void
108
	{
109
		$this->driver->get(\App\Config::main('site_URL') . 'index.php?module=Users&view=Login');
110
		$this->logs = [
111
			'test' => __METHOD__,
112
			'url' => $this->driver->getCurrentURL(),
113
			'getPageSource' => $this->driver->getPageSource(),
114
		];
115
		$this->driver->findElement(WebDriverBy::id('username'))->sendKeys('demo');
116
		$this->driver->findElement(WebDriverBy::id('password'))->sendKeys(\Tests\Base\A_User::$defaultPassrowd);
117
		$this->driver->findElement(WebDriverBy::tagName('form'))->submit();
118
		$this->isLogin = true;
119
	}
120
121
	/**
122
	 * Find error or exceptions.
123
	 *
124
	 * @return void
125
	 */
126
	public function findError(): void
127
	{
128
		$source = $this->driver->getPageSource();
129
		if (false !== stripos($source, 'YetiError!!!')) {
130
			// @codeCoverageIgnoreStart
131
			throw new \Exception('An error has been found');
132
			// @codeCoverageIgnoreEnd
133
		}
134
		if (false !== stripos($source, 'YetiForceError!!!')) {
135
			// @codeCoverageIgnoreStart
136
			throw new \Exception('An error has been found');
137
			// @codeCoverageIgnoreEnd
138
		}
139
		if (false !== stripos($source, 'Undefined variable:')) {
140
			// @codeCoverageIgnoreStart
141
			throw new \Exception('Undefined variable found');
142
			// @codeCoverageIgnoreEnd
143
		}
144
		$browserLogs = $this->driver->manage()->getLog('browser');
145
		if ($browserLogs) {
146
			/** @codeCoverageIgnoreStart */
147
			$log = '';
148
			foreach ($browserLogs as $value) {
149
				if ('SEVERE' === $value['level']) {
150
					$log .= "[{$value['level']}] {$value['message']}\n";
151
				}
152
			}
153
			if ($log) {
154
				throw new \Exception('A JavaScript error has occurred: ' . PHP_EOL . $log);
155
			}
156
			// @codeCoverageIgnoreEnd
157
		}
158
		$this->logs = [
159
			'test' => __METHOD__,
160
			'url' => $this->driver->getCurrentURL(),
161
			'getPageSource' => $source,
162
		];
163
	}
164
}
165