Issues (47)

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.

lib/DocumentManager.php (2 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
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Component\DocumentManager;
13
14
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
15
use Symfony\Component\OptionsResolver\OptionsResolver;
16
17
class DocumentManager implements DocumentManagerInterface
18
{
19
    /**
20
     * @var EventDispatcherInterface
21
     */
22
    private $eventDispatcher;
23
24
    /**
25
     * @var array Cached options resolver instances
26
     */
27
    private $optionsResolvers = [];
28
29
    /**
30
     * @param EventDispatcherInterface $eventDispatcher
31
     */
32
    public function __construct(EventDispatcherInterface $eventDispatcher)
33
    {
34
        $this->eventDispatcher = $eventDispatcher;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 View Code Duplication
    public function find($identifier, $locale = null, array $options = [])
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $options = $this->getOptionsResolver(Events::FIND)->resolve($options);
43
44
        $event = new Event\FindEvent($identifier, $locale, $options);
45
        $this->eventDispatcher->dispatch(Events::FIND, $event);
46
47
        return $event->getDocument();
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function create($alias)
54
    {
55
        $event = new Event\CreateEvent($alias);
56
        $this->eventDispatcher->dispatch(Events::CREATE, $event);
57
58
        return $event->getDocument();
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64 View Code Duplication
    public function persist($document, $locale = null, array $options = [])
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
    {
66
        $options = $this->getOptionsResolver(Events::FIND)->resolve($options);
67
68
        $event = new Event\PersistEvent($document, $locale, $options);
69
        $this->eventDispatcher->dispatch(Events::PERSIST, $event);
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function remove($document)
76
    {
77
        $event = new Event\RemoveEvent($document);
78
        $this->eventDispatcher->dispatch(Events::REMOVE, $event);
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function move($document, $destId)
85
    {
86
        $event = new Event\MoveEvent($document, $destId);
87
        $this->eventDispatcher->dispatch(Events::MOVE, $event);
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function copy($document, $destPath)
94
    {
95
        $event = new Event\CopyEvent($document, $destPath);
96
        $this->eventDispatcher->dispatch(Events::COPY, $event);
97
98
        return $event->getCopiedPath();
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function reorder($document, $destId, $after = false)
105
    {
106
        $event = new Event\ReorderEvent($document, $destId, $after);
107
        $this->eventDispatcher->dispatch(Events::REORDER, $event);
108
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function refresh($document)
114
    {
115
        $event = new Event\RefreshEvent($document);
116
        $this->eventDispatcher->dispatch(Events::REFRESH, $event);
117
    }
118
119
    /**
120
     * {@inheritdoc}
121
     */
122
    public function flush()
123
    {
124
        $event = new Event\FlushEvent();
125
        $this->eventDispatcher->dispatch(Events::FLUSH, $event);
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function clear()
132
    {
133
        $event = new Event\ClearEvent();
134
        $this->eventDispatcher->dispatch(Events::CLEAR, $event);
135
    }
136
137
    /**
138
     * {@inheritdoc}
139
     */
140
    public function createQuery($query, $locale = null, array $options = [])
141
    {
142
        $event = new Event\QueryCreateEvent($query, $locale, $options);
143
        $this->eventDispatcher->dispatch(Events::QUERY_CREATE, $event);
144
145
        return $event->getQuery();
146
    }
147
148
    /**
149
     * {@inheritdoc}
150
     */
151
    public function createQueryBuilder()
152
    {
153
        $event = new Event\QueryCreateBuilderEvent();
154
        $this->eventDispatcher->dispatch(Events::QUERY_CREATE_BUILDER, $event);
155
156
        return $event->getQueryBuilder();
157
    }
158
159
    /**
160
     * {@inheritdoc}
161
     */
162
    private function getOptionsResolver($eventName)
163
    {
164
        if (isset($this->optionsResolvers[$eventName])) {
165
            return $this->optionsResolvers[$eventName];
166
        }
167
168
        $resolver = new OptionsResolver();
169
        $resolver->setDefault('locale', null);
170
171
        $event = new Event\ConfigureOptionsEvent($resolver);
172
        $this->eventDispatcher->dispatch(Events::CONFIGURE_OPTIONS, $event);
173
174
        $this->optionsResolvers[$eventName] = $resolver;
175
176
        return $resolver;
177
    }
178
}
179