GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (7)

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 (2 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 Google Map bundle 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\GoogleMapBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 684
    public function getConfigTreeBuilder()
28
    {
29 684
        $treeBuilder = $this->createTreeBuilder();
30 684
        $children = $treeBuilder->root('ivory_google_map')
31 684
            ->children()
32 684
            ->append($this->createMapNode())
33 684
            ->append($this->createStaticMapNode());
34
35
        $services = [
36 684
            'direction'          => true,
37 532
            'distance_matrix'    => true,
38 532
            'elevation'          => true,
39 532
            'geocoder'           => true,
40 532
            'place_autocomplete' => true,
41 532
            'place_detail'       => true,
42 532
            'place_photo'        => false,
43 532
            'place_search'       => true,
44 532
            'time_zone'          => true,
45 532
        ];
46
47 684
        foreach ($services as $service => $http) {
48 684
            $children->append($this->createServiceNode($service, $http));
49 532
        }
50
51 684
        return $treeBuilder;
52
    }
53
54
    /**
55
     * @return ArrayNodeDefinition
56
     */
57 684
    private function createMapNode()
58
    {
59 684
        return $this->createNode('map')
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 addDefaultsIfNotSet() 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...
60 684
            ->addDefaultsIfNotSet()
61 684
            ->children()
62 684
                ->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
63 684
                ->scalarNode('language')->defaultValue('%locale%')->end()
64 684
                ->scalarNode('api_key')->end()
65 684
            ->end();
66
    }
67
68
    /**
69
     * @return ArrayNodeDefinition
70
     */
71 684
    private function createStaticMapNode()
72
    {
73 684
        return $this->createNode('static_map')
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 addDefaultsIfNotSet() 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 684
            ->addDefaultsIfNotSet()
75 684
            ->children()
76 684
                ->scalarNode('api_key')->end()
77 684
                ->append($this->createBusinessAccountNode(false))
78 684
            ->end();
79
    }
80
81
    /**
82
     * @param string $service
83
     * @param bool   $http
84
     *
85
     * @return ArrayNodeDefinition
86
     */
87 684
    private function createServiceNode($service, $http)
88
    {
89 684
        $node = $this->createNode($service);
90
        $children = $node
91 684
            ->children()
92 684
            ->scalarNode('api_key')->end()
93 684
            ->append($this->createBusinessAccountNode(true));
94
95 684
        if ($http) {
96
            $children
97 684
                ->scalarNode('client')
98 684
                    ->isRequired()
99 684
                    ->cannotBeEmpty()
100 684
                ->end()
101 684
                ->scalarNode('message_factory')
102 684
                    ->isRequired()
103 684
                    ->cannotBeEmpty()
104 684
                ->end()
105 684
                ->scalarNode('format')->end();
106 532
        } else {
107
            $node
108 684
                ->beforeNormalization()
109 684
                    ->ifNull()
110 684
                    ->then(function () {
111 9
                        return [];
112 684
                    })
113 684
                ->end();
114
        }
115
116 684
        return $node;
117
    }
118
119
    /**
120
     * @param bool $service
121
     *
122
     * @return ArrayNodeDefinition
123
     */
124 684
    private function createBusinessAccountNode($service)
125
    {
126 684
        $node = $this->createNode('business_account');
127 684
        $clientIdNode = $node->children()
128 684
            ->scalarNode('secret')
129 684
                ->isRequired()
130 684
                ->cannotBeEmpty()
131 684
            ->end()
132 684
            ->scalarNode('channel')->end()
133 684
            ->scalarNode('client_id');
134
135 684
        if ($service) {
136
            $clientIdNode
137 684
                ->isRequired()
138 684
                ->cannotBeEmpty();
139 532
        }
140
141 684
        return $node;
142
    }
143
144
    /**
145
     * @param string $name
146
     * @param string $type
147
     *
148
     * @return ArrayNodeDefinition|NodeDefinition
149
     */
150 684
    private function createNode($name, $type = 'array')
151
    {
152 684
        return $this->createTreeBuilder()->root($name, $type);
153
    }
154
155
    /**
156
     * @return TreeBuilder
157
     */
158 684
    private function createTreeBuilder()
159
    {
160 684
        return new TreeBuilder();
161
    }
162
}
163