Issues (11)

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.

DependencyInjection/Configuration.php (4 issues)

Labels
Severity

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 the Ivory CKEditor package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\CKEditorBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
/**
19
 * @author GeLo <[email protected]>
20
 */
21
class Configuration implements ConfigurationInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 210
    public function getConfigTreeBuilder()
27
    {
28 210
        $treeBuilder = $this->createTreeBuilder();
29
        $treeBuilder
30 210
            ->root('ivory_ck_editor')
31 210
            ->children()
32 210
                ->booleanNode('enable')->end()
33 210
                ->booleanNode('async')->end()
34 210
                ->booleanNode('auto_inline')->end()
35 210
                ->booleanNode('inline')->end()
36 210
                ->booleanNode('autoload')->end()
37 210
                ->booleanNode('jquery')->end()
38 210
                ->booleanNode('require_js')->end()
39 210
                ->booleanNode('input_sync')->end()
40 210
                ->scalarNode('base_path')->end()
41 210
                ->scalarNode('js_path')->end()
42 210
                ->scalarNode('jquery_path')->end()
43 210
                ->scalarNode('default_config')->end()
44 210
                ->append($this->createConfigsNode())
45 210
                ->append($this->createPluginsNode())
46 210
                ->append($this->createStylesNode())
47 210
                ->append($this->createTemplatesNode())
48 210
                ->append($this->createFilebrowsersNode())
49 210
                ->append($this->createToolbarsNode())
50 210
            ->end();
51
52 210
        return $treeBuilder;
53
    }
54
55
    /**
56
     * @return ArrayNodeDefinition
57
     */
58 210
    private function createConfigsNode()
59
    {
60 210
        return $this->createPrototypeNode('configs')
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method normalizeKeys() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
61 210
            ->prototype('array')
62 210
                ->normalizeKeys(false)
63 210
                ->useAttributeAsKey('name')
64 210
                ->prototype('variable')->end()
65 210
            ->end();
66
    }
67
68
    /**
69
     * @return ArrayNodeDefinition
70
     */
71 210
    private function createPluginsNode()
72
    {
73 210
        return $this->createPrototypeNode('plugins')
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method children() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
74 210
            ->prototype('array')
75 210
                ->children()
76 210
                    ->scalarNode('path')->end()
77 210
                    ->scalarNode('filename')->end()
78 210
                ->end()
79 210
            ->end();
80
    }
81
82
    /**
83
     * @return ArrayNodeDefinition
84
     */
85 210
    private function createStylesNode()
86
    {
87 210
        return $this->createPrototypeNode('styles')
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method prototype() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
88 210
            ->prototype('array')
89 210
                ->prototype('array')
90 210
                    ->children()
91 210
                        ->scalarNode('name')->end()
92 210
                        ->scalarNode('type')->end()
93 210
                        ->scalarNode('widget')->end()
94 210
                        ->variableNode('element')->end()
95 210
                        ->append($this->createPrototypeNode('styles')->prototype('scalar')->end())
96 210
                        ->append($this->createPrototypeNode('attributes')->prototype('scalar')->end())
97 210
                    ->end()
98 210
                ->end()
99 210
            ->end();
100
    }
101
102
    /**
103
     * @return ArrayNodeDefinition
104
     */
105 210
    private function createTemplatesNode()
106
    {
107 210
        return $this->createPrototypeNode('templates')
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method children() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
108 210
            ->prototype('array')
109 210
                ->children()
110 210
                    ->scalarNode('imagesPath')->end()
111 210
                    ->arrayNode('templates')
112 210
                        ->prototype('array')
113 210
                            ->children()
114 210
                                ->scalarNode('title')->end()
115 210
                                ->scalarNode('image')->end()
116 210
                                ->scalarNode('description')->end()
117 210
                                ->scalarNode('html')->end()
118 210
                                ->scalarNode('template')->end()
119 210
                                ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end())
120 210
                            ->end()
121 210
                        ->end()
122 210
                    ->end()
123 210
                ->end()
124 210
            ->end();
125
    }
126
127
    /**
128
     * @return ArrayNodeDefinition
129
     */
130 210
    private function createFilebrowsersNode()
131
    {
132 210
        return $this->createNode('filebrowsers')
133 210
            ->useAttributeAsKey('name')
134 210
            ->prototype('scalar')
135 210
            ->end();
136
    }
137
138
    /**
139
     * @return ArrayNodeDefinition
140
     */
141 210
    private function createToolbarsNode()
142
    {
143 210
        return $this->createNode('toolbars')
144 210
            ->addDefaultsIfNotSet()
145 210
            ->children()
146 210
                ->arrayNode('configs')
147 210
                    ->useAttributeAsKey('name')
148 210
                    ->prototype('array')
149 210
                        ->prototype('variable')->end()
150 210
                    ->end()
151 210
                ->end()
152 210
                ->arrayNode('items')
153 210
                    ->useAttributeAsKey('name')
154 210
                    ->prototype('array')
155 210
                        ->prototype('variable')->end()
156 210
                    ->end()
157 210
                ->end()
158 210
            ->end();
159
    }
160
161
    /**
162
     * @param string $name
163
     *
164
     * @return ArrayNodeDefinition
165
     */
166 210
    private function createPrototypeNode($name)
167
    {
168 210
        return $this->createNode($name)
169 210
            ->normalizeKeys(false)
170 210
            ->useAttributeAsKey('name');
171
    }
172
173
    /**
174
     * @param string $name
175
     *
176
     * @return ArrayNodeDefinition
177
     */
178 210
    private function createNode($name)
179
    {
180 210
        return $this->createTreeBuilder()->root($name);
181
    }
182
183
    /**
184
     * @return TreeBuilder
185
     */
186 210
    private function createTreeBuilder()
187
    {
188 210
        return new TreeBuilder();
189
    }
190
}
191