Issues (789)

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.

app/services/SkautIS/SkautisService.php (3 issues)

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
namespace App\Services\SkautIS;
4
5
use Nette\Object;
6
use Skautis\Skautis;
7
8
/**
9
 * SkautIS service
10
 */
11
abstract class SkautisService extends Object
12
{
13
14
	/**
15
	 * Class Table reference
16
	 * @var instance of BaseTable
17
	 */
18
	protected $table;
19
20
21
	/**
22
	 * Holds SkautIS instance
23
	 * @var Skautis\Skautis
24
	 */
25
	protected $skautis;
26
27
28
	/**
29
	 * Use local storage (cache)?
30
	 * @var bool
31
	 */
32
	private $useCache = TRUE;
33
34
35
	/**
36
	 * Short term storage for saving SkautIS answers
37
	 * @var type
38
	 */
39
	private static $storage;
40
41
42
	/**
43
	 * Construct
44
	 */
45
	public function __construct(Skautis $skautIS = NULL)
46
	{
47
		$this->setSkautis($skautIS);
0 ignored issues
show
It seems like $skautIS defined by parameter $skautIS on line 45 can be null; however, App\Services\SkautIS\SkautisService::setSkautis() does not accept null, maybe add an additional type check?

It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.

We recommend to add an additional type check (or disallow null for the parameter):

function notNullable(stdClass $x) { }

// Unsafe
function withoutCheck(stdClass $x = null) {
    notNullable($x);
}

// Safe - Alternative 1: Adding Additional Type-Check
function withCheck(stdClass $x = null) {
    if ($x instanceof stdClass) {
        notNullable($x);
    }
}

// Safe - Alternative 2: Changing Parameter
function withNonNullableParam(stdClass $x) {
    notNullable($x);
}
Loading history...
48
		self::$storage = array();
0 ignored issues
show
Documentation Bug introduced by
It seems like array() of type array is incompatible with the declared type object<App\Services\SkautIS\type> of property $storage.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
	}
50
51
52
	/**
53
	 * Get user information
54
	 *
55
	 * @param   void
56
	 * @return  array  Login ID, Role ID, Unit ID
57
	 */
58
	public function getInfo()
59
	{
60
		$skautis = $this->getSkautis();
61
62
		return [
63
			"ID_Login" => $skautis->getUser()->getLoginId(),
64
			"ID_Role"  => $skautis->getUser()->getRoleId(),
65
			"ID_Unit"  => $skautis->getUser()->getUnitId(),
66
		];
67
	}
68
69
70
	/**
71
	 * Save value to local storage
72
	 *
73
	 * @param   mixed  $id
74
	 * @param   mixed  $val
75
	 * @return  mixed
76
	 */
77
	protected function save($id, $val)
78
	{
79
		if ($this->useCache) {
80
			self::$storage[$id] = $val;
81
		}
82
		return $val;
83
	}
84
85
86
	/**
87
	 * Get object from local storage
88
	 *
89
	 * @param   string|int   $id
90
	 * @return  mixed|FALSE
91
	 */
92
	protected function load($id)
93
	{
94
		if ($this->useCache && array_key_exists($id, self::$storage)) {
95
			return self::$storage[$id];
96
		}
97
		return FALSE;
98
	}
99
100
	/**
101
	 * @return Skautis\Skautis
102
	 */
103
	public function getSkautis(): Skautis
104
	{
105
		return $this->skautis;
106
	}
107
108
	/**
109
	 * @param Skautis\Skautis $skautis
110
	 *
111
	 * @return self
112
	 */
113
	public function setSkautis(Skautis $skautis): self
114
	{
115
		$this->skautis = $skautis;
0 ignored issues
show
Documentation Bug introduced by
It seems like $skautis of type object<Skautis\Skautis> is incompatible with the declared type object<Skautis\Skautis\Skautis> of property $skautis.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
116
117
		return $this;
118
	}
119
120
}
121