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.

app/Company.php (1 issue)

1
<?php
2
/**
3
 * Company basic file.
4
 *
5
 * @package App
6
 *
7
 * @copyright YetiForce S.A.
8
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
9
 * @author    Mariusz Krzaczkowski <[email protected]>
10
 * @author    Radosław Skrzypczak <[email protected]>
11
 */
12
13
namespace App;
14
15
/**
16
 * Company basic class.
17
 */
18
class Company extends Base
19
{
20
	/** @var string Edit view URL */
21
	public const EDIT_VIEW_URL = 'index.php?parent=Settings&module=Companies&view=Edit';
22
23
	/**
24
	 * Classification of enterprises due to their size.
25
	 *
26
	 * @var int[]
27
	 */
28
	public static array $sizes = [
29
		'Micro' => 20,
30
		'Small' => 50,
31
		'Medium' => 250,
32
		'Large' => 1000,
33
		'Corporation' => 0,
34
	];
35
36
	/**
37
	 * Function to get the instance of the Company model.
38
	 *
39
	 * @throws \App\Exceptions\DbException
40
	 *
41
	 * @return array|bool
42
	 */
43
	public static function getCompany()
44
	{
45
		if (Cache::staticHas('CompanyGet', '')) {
46
			return Cache::staticGet('CompanyGet', '');
47
		}
48
		$row = (new Db\Query())->from('s_#__companies')->one(Db::getInstance('admin'));
49
		if (!$row) {
50
			throw new Exceptions\DbException('LBL_RECORD_NOT_FOUND');
51
		}
52
		Cache::staticSave('CompanyGet', '', $row, Cache::LONG);
0 ignored issues
show
The call to App\Cache::staticSave() has too many arguments starting with App\Cache::LONG. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
		Cache::/** @scrutinizer ignore-call */ 
53
         staticSave('CompanyGet', '', $row, Cache::LONG);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
53
54
		return $row;
55
	}
56
57
	/**
58
	 * Get company size.
59
	 *
60
	 * @return string
61
	 */
62
	public static function getSize(): string
63
	{
64
		$count = User::getNumberOfUsers();
65
		$return = 'Micro';
66
		$last = 0;
67
		foreach (self::$sizes as $size => $value) {
68
			if (0 !== $value && $count <= $value && $count > $last) {
69
				return $size;
70
			}
71
			if (0 === $value && $count > 1000) {
72
				$return = $size;
73
			}
74
			$last = $value;
75
		}
76
		return $return;
77
	}
78
79
	/**
80
	 * Compare company size.
81
	 *
82
	 * @param string $package
83
	 *
84
	 * @return bool
85
	 */
86
	public static function compareSize(string $package): bool
87
	{
88
		$size = self::$sizes[$package] ?? '';
89
		if (0 === $size) {
90
			return true;
91
		}
92
		return $size >= User::getNumberOfUsers();
93
	}
94
}
95