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 (26)

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/DependencyInjection/SurfnetStepupExtension.php (2 issues)

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
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupBundle\DependencyInjection;
20
21
use GuzzleHttp\HandlerStack;
22
use GuzzleHttp\Middleware;
23
use Surfnet\StepupBundle\Form\ChoiceList\LocaleChoiceList;
24
use Surfnet\StepupBundle\Http\CookieHelper;
25
use Surfnet\StepupBundle\Service\LoaResolutionService;
26
use Surfnet\StepupBundle\Service\SecondFactorTypeService;
27
use Surfnet\StepupBundle\Service\SmsSecondFactorService;
28
use Surfnet\StepupBundle\Value\Loa;
29
use Symfony\Component\Config\Definition\Processor;
30
use Symfony\Component\Config\FileLocator;
31
use Symfony\Component\DependencyInjection\ContainerBuilder;
32
use Symfony\Component\DependencyInjection\Definition;
33
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
34
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
35
use Symfony\Component\DependencyInjection\Reference;
36
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
37
38
/**
39
 * Class SurfnetStepupExtension
40
 *
41
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
42
 */
43
class SurfnetStepupExtension extends Extension
44
{
45
    public function load(array $config, ContainerBuilder $container)
46
    {
47
        $processor = new Processor();
48
        $config = $processor->processConfiguration(new Configuration(), $config);
49
50
        $container->setParameter('logging.application_name', $config['logging']['application_name']);
51
52
        $loader = new YamlFileLoader(
53
            $container,
54
            new FileLocator(__DIR__ . '/../Resources/config')
55
        );
56
        $loader->load('services.yml');
57
58
        if (isset($config['loa_definition']) && $config['loa_definition']['enabled']) {
59
            $this->defineLoas($config['loa_definition'], $container);
60
        } else {
61
            $container->removeDefinition('surfnet_stepup.service.loa_resolution');
62
            $container->removeAlias(LoaResolutionService::class);
63
        }
64
65
        if ($config['sms']['enabled'] === false) {
66
            $container->removeDefinition('surfnet_stepup.service.sms_second_factor');
67
            $container->removeAlias(SmsSecondFactorService::class);
68
            $container->removeDefinition('surfnet_stepup.service.challenge_handler');
69
        } else {
70
            $this->configureSmsSecondFactorServices($config, $container);
71
            if (!$config['gateway_api']['enabled'] && $config['sms']['service'] === Configuration::DEFAULT_SMS_SERVICE) {
72
                throw new RuntimeException(
73
                    'The gateway API is not enabled and no replacement SMS service is configured'
74
                );
75
            }
76
        }
77
78
        if ($config['gateway_api']['enabled']) {
79
            $this->configureGatewayApiClient($config, $container);
80
        } else {
81
            // Remove the Gateway API SMS service and its Guzzle client.
82
            $container->removeDefinition('surfnet_stepup.service.gateway_api_sms');
83
            $container->removeDefinition('surfnet_stepup.guzzle.gateway_api');
84
        }
85
86
        if ($config['locale_cookie']['enabled']) {
87
            $this->configureLocaleCookieSettings($config, $container);
88
        } else {
89
            $container->removeDefinition('surfnet_stepup.locale_cookie_helper');
90
            $container->removeAlias(CookieHelper::class);
91
            $container->removeDefinition('surfnet_stepup.locale_cookie_settings');
92
        }
93
94
        $this->configureLocaleSelectionWidget($config, $container);
95
        $this->configureSecondFactorTypeService($config, $container);
96
    }
97
98
    private function defineLoas(array $loaDefinitions, ContainerBuilder $container)
99
    {
100
        $loaService = $container->getDefinition('surfnet_stepup.service.loa_resolution');
101
102
        $loa1 = new Definition('Surfnet\StepupBundle\Value\Loa', [Loa::LOA_1, $loaDefinitions['loa1']]);
103
        $loa2 = new Definition('Surfnet\StepupBundle\Value\Loa', [Loa::LOA_2, $loaDefinitions['loa2']]);
104
        $loa3 = new Definition('Surfnet\StepupBundle\Value\Loa', [Loa::LOA_3, $loaDefinitions['loa3']]);
105
106
        $loaService->addArgument([$loa1, $loa2, $loa3]);
107
    }
108
109
    /**
110
     * @param array            $config
111
     * @param ContainerBuilder $container
112
     */
113
    private function configureLocaleCookieSettings(array $config, ContainerBuilder $container)
114
    {
115
        $container->getDefinition('surfnet_stepup.locale_cookie_settings')
116
            ->setArguments(
117
                [
118
                    $config['locale_cookie']['name'],
119
                    null,
120
                    $config['locale_cookie']['expire'],
121
                    $config['locale_cookie']['path'],
122
                    $config['locale_cookie']['domain'],
123
                    $config['locale_cookie']['secure'],
124
                    $config['locale_cookie']['http_only'],
125
                ]
126
            );
127
    }
128
129
    /**
130
     * @param array            $config
131
     * @param ContainerBuilder $container
132
     */
133
    private function configureGatewayApiClient(array $config, ContainerBuilder $container)
134
    {
135
        $handlerStack = $container->getDefinition('surfnet_stepup.guzzle.handler_stack');
136
137
        // Configure the Gateway API SMS service's Guzzle client.
138
        $gatewayGuzzleOptions = [
139
            'base_uri' => $config['gateway_api']['url'],
140
            'auth'    => [
141
                $config['gateway_api']['credentials']['username'],
142
                $config['gateway_api']['credentials']['password'],
143
                'basic'
144
            ],
145
            'headers' => [
146
                'Accept' => 'application/json'
147
            ],
148
            'handler' => $handlerStack,
149
            'http_errors' => false
150
        ];
151
152
        $gatewayGuzzle = $container->getDefinition('surfnet_stepup.guzzle.gateway_api');
153
        $gatewayGuzzle->replaceArgument(0, $gatewayGuzzleOptions);
154
    }
155
156
    /**
157
     * @param array            $config
158
     * @param ContainerBuilder $container
159
     */
160
    private function configureSmsSecondFactorServices(array $config, ContainerBuilder $container)
161
    {
162
        $smsSecondFactorService = $container->getDefinition('surfnet_stepup.service.sms_second_factor');
163
        $smsSecondFactorService->replaceArgument(2, $config['sms']['originator']);
164
165
        $container
166
            ->getDefinition('surfnet_stepup.service.challenge_handler')
167
            ->replaceArgument(2, $config['sms']['otp_expiry_interval'])
168
            ->replaceArgument(3, $config['sms']['maximum_otp_requests']);
169
170
        $container
171
            ->getDefinition('surfnet_stepup.service.sms_second_factor')
172
            ->replaceArgument(0, new Reference($config['sms']['service']));
173
    }
174
175
    private function configureLocaleSelectionWidget(array $loaDefinitions, ContainerBuilder $container)
0 ignored issues
show
The parameter $loaDefinitions 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...
176
    {
177
        if ($container->hasParameter('locales')) {
178
            $container->getDefinition('surfnet_stepup.form.choice_list.locales')
179
                ->replaceArgument(0, $container->getParameter('locales'));
180
        } else {
181
            $container->removeDefinition('surfnet_stepup.form.choice_list.locales');
182
            $container->removeAlias(LocaleChoiceList::class);
183
            $container->removeDefinition('surfnet_stepup.form.switch_locale');
184
        }
185
    }
186
187
    private function configureSecondFactorTypeService(array $loaDefinitions, ContainerBuilder $container)
0 ignored issues
show
The parameter $loaDefinitions 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
        if (!$container->hasParameter('enabled_generic_second_factors')) {
190
            $container->removeDefinition('surfnet_stepup.service.second_factor_type');
191
            $container->removeAlias(SecondFactorTypeService::class);
192
        }
193
    }
194
}
195