Issues (245)

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.

src/Service/ServiceRegistry.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
 * Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
4
 *
5
 * Licensed under The MIT License
6
 * Redistributions of files must retain the above copyright notice.
7
 *
8
 * @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
9
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
10
 */
11
namespace CakeDC\Api\Service;
12
13
use CakeDC\Api\Service\Locator\LocatorInterface;
14
use Cake\Event\EventDispatcherInterface;
15
use Cake\Event\EventDispatcherTrait;
16
17
class ServiceRegistry implements EventDispatcherInterface
18
{
19
20
    use EventDispatcherTrait;
21
22
    /**
23
     * LocatorInterface implementation instance.
24
     *
25
     * @var \Cake\ORM\Locator\LocatorInterface
26
     */
27
    protected static $_locator;
28
29
    /**
30
     * Default LocatorInterface implementation class.
31
     *
32
     * @var string
33
     */
34
    protected static $_defaultLocatorClass = 'CakeDC\Api\Service\Locator\ServiceLocator';
35
36
    /**
37
     * Sets and returns a singleton instance of LocatorInterface implementation.
38
     *
39
     * @param \CakeDC\Api\Service\Locator\LocatorInterface|null $locator Instance of a locator to use.
40
     * @return \CakeDC\Api\Service\Locator\LocatorInterface
41
     * @deprecated 3.5.0 Use getServiceLocator()/setServiceLocator() instead.
42
     */
43
    public static function locator(LocatorInterface $locator = null)
44
    {
45
        deprecationWarning(
46
            'TableRegistry::locator() is deprecated. ' .
47
            'Use setServiceLocator()/getServiceLocator() instead.'
48
        );
49
        if ($locator) {
50
            static::setServiceLocator($locator);
51
        }
52
53
        return static::getServiceLocator();
54
    }
55
56
    /**
57
     * Returns a singleton instance of LocatorInterface implementation.
58
     *
59
     * @return \CakeDC\Api\Service\Locator\LocatorInterface
60
     */
61 108
    public static function getServiceLocator()
62
    {
63 108
        if (!static::$_locator) {
64 1
            static::$_locator = new static::$_defaultLocatorClass();
65 1
        }
66
67 108
        return static::$_locator;
68
    }
69
70
    /**
71
     * Sets singleton instance of LocatorInterface implementation.
72
     *
73
     * @param \CakeDC\Api\Service\Locator\LocatorInterface $serviceLocator Instance of a locator to use.
74
     * @return void
75
     */
76
    public static function setServiceLocator(LocatorInterface $serviceLocator)
77
    {
78
        static::$_locator = $serviceLocator;
0 ignored issues
show
Documentation Bug introduced by
It seems like $serviceLocator of type object<CakeDC\Api\Servic...cator\LocatorInterface> is incompatible with the declared type object<Cake\ORM\Locator\LocatorInterface> of property $_locator.

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...
79
    }
80
81
    /**
82
     * Stores a list of options to be used when instantiating an object
83
     * with a matching alias.
84
     *
85
     * @param string|null $alias Name of the alias
86
     * @param array|null $options list of options for the alias
87
     * @return array The config data.
88
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::getConfig()/setConfig() instead.
89
     */
90
    public static function config($alias = null, $options = null)
91
    {
92
        deprecationWarning(
93
            'ServiceRegistry::config() is deprecated. ' .
94
            'Use \CakeDC\Api\Service\Locator\ServiceLocator::getConfig()/setConfig() instead.'
95
        );
96
97
        return static::getServiceLocator()->config($alias, $options);
98
    }
99
100
    /**
101
     * Get a table instance from the registry.
102
     *
103
     * @param string $alias The alias name you want to get.
104
     * @param array $options The options you want to build the table with.
105
     * @return \CakeDC\Api\Service\Service
106
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::get() instead.
107
     */
108 35
    public static function get($alias, array $options = [])
109
    {
110 35
        return static::getServiceLocator()->get($alias, $options);
111
    }
112
113
    /**
114
     * Check to see if an instance exists in the registry.
115
     *
116
     * @param string $alias The alias to check for.
117
     * @return bool
118
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::exists() instead.
119
     */
120
    public static function exists($alias)
121
    {
122
        return static::getServiceLocator()->exists($alias);
123
    }
124
125
    /**
126
     * Set an instance.
127
     *
128
     * @param string $alias The alias to set.
129
     * @param \CakeDC\Api\Service\Service $object The table to set.
130
     * @return \CakeDC\Api\Service\Service
131
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::set() instead.
132
     */
133
    public static function set($alias, Service $object)
134
    {
135
        return static::getServiceLocator()->set($alias, $object);
136
    }
137
138
    /**
139
     * Removes an instance from the registry.
140
     *
141
     * @param string $alias The alias to remove.
142
     * @return void
143
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::remove() instead.
144
     */
145
    public static function remove($alias)
146
    {
147
        static::getServiceLocator()->remove($alias);
148
    }
149
150
    /**
151
     * Clears the registry of configuration and instances.
152
     *
153
     * @return void
154
     * @deprecated 3.6.0 Use \CakeDC\Api\Service\Locator\ServiceLocator::clear() instead.
155
     */
156 108
    public static function clear()
157
    {
158 108
        static::getServiceLocator()->clear();
159 108
    }
160
161
    /**
162
     * Proxy for static calls on a locator.
163
     *
164
     * @param string $name Method name.
165
     * @param array $arguments Method arguments.
166
     * @return mixed
167
     */
168
    public static function __callStatic($name, $arguments)
169
    {
170
        deprecationWarning(
171
            'TableRegistry::' . $name . '() is deprecated. ' .
172
            'Use \CakeDC\Api\Service\Locator\ServiceLocator::' . $name . '() instead.'
173
        );
174
175
        return call_user_func_array([static::getServiceLocator(), $name], $arguments);
176
    }
177
}
178