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/presenters/AnnotationPresenter.php (6 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\Presenters;
4
5
use App\Components\Forms\AnnotationForm;
6
use App\Components\Forms\Factories\IAnnotationFormFactory;
7
use App\Models\MeetingModel;
8
use App\Services\AnnotationService;
9
use \Exception;
10
11
class AnnotationPresenter extends BasePresenter
12
{
13
14
	/**
15
	 * @var IAnnotationFormFactory
16
	 */
17
	private $annotationFormFactory;
18
19
	/**
20
	 * @var AnnotationService
21
	 */
22
	private $annotationService;
23
24
	/**
25
	 * @var MeetingModel
26
	 */
27
	private $meetingModel;
28
29
	/**
30
	 * @param AnnotationService $service
31
	 * @param MeetingModel $model
32
	 */
33
	public function __construct(AnnotationService $service, MeetingModel $model)
34
	{
35
		$this->setAnnotationService($service);
36
		$this->setMeetingModel($model);
37
	}
38
39
	/**
40
	 * @param  IAnnotationFormFactory $factory
41
	 */
42
	public function injectAnnotationFormFactory(IAnnotationFormFactory $factory)
43
	{
44
		$this->annotationFormFactory = $factory;
45
	}
46
47
	/**
48
	 * @param  string $id
0 ignored issues
show
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
49
	 * @param  string $type
50
	 */
51
	public function renderEdit(string $guid, string $type)
52
	{
53
		$template = $this->getTemplate();
54
55
		$annotation = $this->getAnnotationService()->findByType($guid, $type);
56
57
		$template->guid = $guid;
0 ignored issues
show
Accessing guid on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
58
		$template->annotation = $annotation;
0 ignored issues
show
Accessing annotation on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
59
		$template->meeting = $this->getMeetingModel()->find($this->getMeetingId());
0 ignored issues
show
Accessing meeting on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
60
		$template->program = $this->getAnnotationService()->findParentProgram($annotation);
0 ignored issues
show
Accessing program on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
$annotation is of type object<Nette\Database\Table\IRow>|false, but the function expects a object<Nette\Database\Table\ActiveRow>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
61
62
		$this['annotationForm']->setDefaults($annotation->toArray());
63
	}
64
65
	/**
66
	 * @return AnnotationFormControl
67
	 */
68
	protected function createComponentAnnotationForm(): AnnotationForm
69
	{
70
		$control = $this->annotationFormFactory->create();
71
		$control->setMeetingId($this->getMeetingId());
72
		$type = $this->getParameter('type');
73
		$control->onAnnotationSave[] = function(AnnotationForm $control, $annotation) use ($type) {
74
			try {
75
				$result = $this->getAnnotationService()->updateByType($type, $annotation);
76
77
				$this->logInfo('Modification of annotation id %s with data %s successfull, result: %s',	[
78
					$annotation->guid,
79
					json_encode($annotation),
80
					json_encode($result),
81
				]);
82
83
				$this->flashSuccess('Položka byla úspěšně upravena');
84
			} catch(Exception $e) {
85
				$this->logError("Modification of annotation id {$annotation->guid} failed, result: {$e->getMessage()}");
86
87
				$this->flashError("Modification of annotation id {$annotation->guid} failed, result: {$e->getMessage()}");
88
			}
89
		};
90
91
		return $control;
92
	}
93
94
	/**
95
	 * @return AnnotationService
96
	 */
97
	public function getAnnotationService(): AnnotationService
98
	{
99
		return $this->annotationService;
100
	}
101
102
	/**
103
	 * @param AnnotationService $annotationService
104
	 *
105
	 * @return self
106
	 */
107
	public function setAnnotationService(AnnotationService $annotationService): self
108
	{
109
		$this->annotationService = $annotationService;
110
111
		return $this;
112
	}
113
114
	/**
115
	 * @return MeetingModel
116
	 */
117
	public function getMeetingModel(): MeetingModel
118
	{
119
		return $this->meetingModel;
120
	}
121
122
	/**
123
	 * @param MeetingModel $meetingModel
124
	 *
125
	 * @return self
126
	 */
127
	public function setMeetingModel(MeetingModel $meetingModel): self
128
	{
129
		$this->meetingModel = $meetingModel;
130
131
		return $this;
132
	}
133
134
}
135