Issues (655)

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.

tests/App/Model/ModelManager.php (5 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
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\App\Model;
15
16
use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
17
use Sonata\AdminBundle\Datagrid\DatagridInterface;
18
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
19
use Sonata\AdminBundle\Model\LockInterface;
20
use Sonata\AdminBundle\Model\ModelManagerInterface;
21
use Sonata\AdminBundle\Tests\App\Admin\FieldDescription;
22
23
class ModelManager implements ModelManagerInterface, LockInterface
24
{
25
    /**
26
     * @var FooRepository
27
     */
28
    private $repository;
29
30
    public function __construct(FooRepository $repository)
31
    {
32
        $this->repository = $repository;
33
    }
34
35
    public function getNewFieldDescriptionInstance($class, $name, array $options = [])
36
    {
37
        if (!isset($options['route']['name'])) {
38
            $options['route']['name'] = 'edit';
39
        }
40
41
        if (!isset($options['route']['parameters'])) {
42
            $options['route']['parameters'] = [];
43
        }
44
45
        $fieldDescription = new FieldDescription();
46
        $fieldDescription->setName($name);
47
        $fieldDescription->setOptions($options);
48
49
        return $fieldDescription;
50
    }
51
52
    public function create($object): void
53
    {
54
    }
55
56
    public function update($object): void
57
    {
58
    }
59
60
    public function delete($object): void
61
    {
62
    }
63
64
    public function findBy($class, array $criteria = [])
65
    {
66
        return [];
67
    }
68
69
    public function findOneBy($class, array $criteria = [])
70
    {
71
        return null;
72
    }
73
74
    public function find($class, $id)
75
    {
76
        return $this->repository->byId($id);
77
    }
78
79
    public function batchDelete($class, ProxyQueryInterface $queryProxy): void
80
    {
81
    }
82
83
    public function getParentFieldDescription($parentAssociationMapping, $class): FieldDescriptionInterface
84
    {
85
        throw new \BadMethodCallException('Not implemented.');
86
    }
87
88
    public function createQuery($class, $alias = 'o'): ProxyQueryInterface
89
    {
90
        throw new \BadMethodCallException('Not implemented.');
91
    }
92
93
    public function getModelIdentifier($class)
0 ignored issues
show
The parameter $class is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
94
    {
95
        return 'id';
96
    }
97
98
    public function getIdentifierValues($model)
99
    {
100
        return [];
101
    }
102
103
    public function getIdentifierFieldNames($class)
104
    {
105
        return [];
106
    }
107
108
    public function getNormalizedIdentifier($model)
109
    {
110
        return $model->getId();
111
    }
112
113
    public function getUrlSafeIdentifier($model)
114
    {
115
        return $this->getNormalizedIdentifier($model);
116
    }
117
118
    public function getModelInstance($class)
119
    {
120
        switch ($class) {
121
            case Translated::class:
122
                return new Translated();
123
            default:
124
                return new Foo('test_id', 'foo_name');
125
        }
126
    }
127
128
    public function getModelCollectionInstance($class)
129
    {
130
        return [];
131
    }
132
133
    public function collectionRemoveElement(&$collection, &$element): void
134
    {
135
    }
136
137
    public function collectionAddElement(&$collection, &$element): void
138
    {
139
    }
140
141
    public function collectionHasElement(&$collection, &$element): void
142
    {
143
    }
144
145
    public function collectionClear(&$collection): void
146
    {
147
    }
148
149
    public function getSortParameters(FieldDescriptionInterface $fieldDescription, DatagridInterface $datagrid)
0 ignored issues
show
The parameter $fieldDescription is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $datagrid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
150
    {
151
        return [];
152
    }
153
154
    public function getDefaultSortValues($class)
155
    {
156
        return [];
157
    }
158
159
    public function getDefaultPerPageOptions(string $class): array
160
    {
161
        return [];
162
    }
163
164
    public function modelReverseTransform($class, array $array = []): object
165
    {
166
        throw new \BadMethodCallException('Not implemented.');
167
    }
168
169
    public function modelTransform($class, $instance): object
170
    {
171
        throw new \BadMethodCallException('Not implemented.');
172
    }
173
174
    public function executeQuery($query): void
175
    {
176
    }
177
178
    public function getDataSourceIterator(DatagridInterface $datagrid, array $fields, $firstResult = null, $maxResult = null): void
179
    {
180
    }
181
182
    public function getExportFields($class)
183
    {
184
        return [];
185
    }
186
187
    public function getPaginationParameters(DatagridInterface $datagrid, $page)
0 ignored issues
show
The parameter $datagrid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $page is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
188
    {
189
        return [];
190
    }
191
192
    public function addIdentifiersToQuery($class, ProxyQueryInterface $query, array $idx): void
193
    {
194
    }
195
196
    public function getLockVersion($object)
197
    {
198
        return null;
199
    }
200
201
    public function lock($object, $expectedVersion)
202
    {
203
    }
204
}
205