Issues (90)

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.

src/ResourceLoader/ResourceLoaderService.php (1 issue)

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
 * @link    https://github.com/nnx-framework/doctrine-fixture-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\DoctrineFixtureModule\ResourceLoader;
7
8
use Doctrine\Fixture\Fixture;
9
10
/**
11
 * Class ResourceLoaderService
12
 *
13
 * @package Nnx\DoctrineFixtureModule\ResourceLoader
14
 */
15
class ResourceLoaderService implements ResourceLoaderServiceInterface
16
{
17
18
    /**
19
     * Ключем является имя класса фикстуры, а значением, конфиг описыайющи загрузчик ресурсов
20
     *
21
     * @var array
22
     */
23
    protected $classFixtureToResourceLoader = [];
24
25
    /**
26
     * Менеджер плагинов, отвечающиз за загрузку ресурсов для фикстур
27
     *
28
     * @var ResourceLoaderManagerInterface
29
     */
30
    protected $resourceLoaderManager;
31
32
    /**
33
     * ResourceLoaderService constructor.
34
     *
35
     * @param ResourceLoaderManagerInterface $resourceLoaderManager
36
     */
37
    public function __construct(ResourceLoaderManagerInterface $resourceLoaderManager)
38
    {
39
        $this->setResourceLoaderManager($resourceLoaderManager);
40
    }
41
42
    /**
43
     * Возвращает массив ключем которого является имя класса фикстуры, а значением, конфиг описыайющи загрузчик ресурсов
44
     *
45
     * @return array
46
     */
47
    public function getClassFixtureToResourceLoader()
48
    {
49
        return $this->classFixtureToResourceLoader;
50
    }
51
52
    /**
53
     * Возвращает массив ключем которого является имя класса фикстуры, а значением, конфиг описыайющи загрузчик ресурсов
54
     *
55
     * @param array $classFixtureToResourceLoader
56
     *
57
     * @return $this
58
     */
59
    public function setClassFixtureToResourceLoader(array $classFixtureToResourceLoader = [])
60
    {
61
        $this->classFixtureToResourceLoader = $classFixtureToResourceLoader;
62
63
        return $this;
64
    }
65
66
    /**
67
     * Возвращает менеджер плагинов, отвечающих за загрузку ресурсов для фикстур
68
     *
69
     * @return ResourceLoaderManagerInterface
70
     */
71
    public function getResourceLoaderManager()
72
    {
73
        return $this->resourceLoaderManager;
74
    }
75
76
    /**
77
     * Устанавливает менеджер плагинов, отвечающих за загрузку ресурсов для фикстур
78
     *
79
     * @param ResourceLoaderManagerInterface $resourceLoaderManager
80
     *
81
     * @return $this
82
     */
83
    public function setResourceLoaderManager($resourceLoaderManager)
84
    {
85
        $this->resourceLoaderManager = $resourceLoaderManager;
86
87
        return $this;
88
    }
89
90
    /**
91
     * @inheritDoc
92
     * @throws \Nnx\DoctrineFixtureModule\ResourceLoader\Exception\InvalidFixtureResourceLoaderConfigException
93
     */
94
    public function loadResourceForFixture(Fixture $fixture)
95
    {
96
        $classFixture = get_class($fixture);
97
98
        $classFixtureToResourceLoader = $this->getClassFixtureToResourceLoader();
99
        if (array_key_exists($classFixture, $classFixtureToResourceLoader)) {
100
            $fixtureResourceLoaderConfig = $this->buildFixtureResourceLoaderConfig($classFixtureToResourceLoader[$classFixture]);
101
            $fixtureResourceLoader = $this->getResourceLoaderManager()->get($fixtureResourceLoaderConfig['name'], $fixtureResourceLoaderConfig['options']);
0 ignored issues
show
The call to ResourceLoaderManagerInterface::get() has too many arguments starting with $fixtureResourceLoaderConfig['options'].

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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
102
            $fixtureResourceLoader->loadResourceForFixture($fixture);
103
        }
104
    }
105
106
    /**
107
     * Подготавливает данные необходимые для получения загрузчика ресурсов фикстуры
108
     *
109
     * @param mixed $fixtureResourceLoaderConfigData
110
     *
111
     * @throws \Nnx\DoctrineFixtureModule\ResourceLoader\Exception\InvalidFixtureResourceLoaderConfigException
112
     *
113
     * @return array
114
     */
115
    public function buildFixtureResourceLoaderConfig($fixtureResourceLoaderConfigData = null)
116
    {
117
        $fixtureResourceLoaderConfig = [];
118
119
        if (!is_array($fixtureResourceLoaderConfigData)) {
120
            $errMsg = 'Fixture resource loader config is not array';
121
            throw new Exception\InvalidFixtureResourceLoaderConfigException($errMsg);
122
        }
123
124
        if (!array_key_exists('name', $fixtureResourceLoaderConfigData)) {
125
            $errMsg = 'Resource loader name not defined';
126
            throw new Exception\InvalidFixtureResourceLoaderConfigException($errMsg);
127
        }
128
        $fixtureResourceLoaderConfig['name'] = (string)$fixtureResourceLoaderConfigData['name'];
129
130
        $fixtureResourceLoaderConfig['options'] = [];
131
        if (array_key_exists('options', $fixtureResourceLoaderConfigData)) {
132
            $fixtureResourceLoaderConfig['options'] = (array)$fixtureResourceLoaderConfigData['options'];
133
        }
134
135
        return $fixtureResourceLoaderConfig;
136
    }
137
}
138