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/Controller/ExceptionController.php (4 issues)

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\Controller;
20
21
use DateTime;
22
use Exception;
23
use SAML2\Response\Exception\InvalidResponseException;
24
use SAML2\Response\Exception\PreconditionNotMetException;
25
use Surfnet\SamlBundle\Http\Exception\AuthnFailedSamlResponseException;
26
use Surfnet\SamlBundle\Http\Exception\SignatureValidationFailedException;
27
use Surfnet\SamlBundle\Http\Exception\UnknownServiceProviderException;
28
use Surfnet\SamlBundle\Http\Exception\UnsignedRequestException;
29
use Surfnet\SamlBundle\Http\Exception\UnsupportedSignatureException;
30
use Surfnet\StepupBundle\EventListener\RequestIdRequestResponseListener;
31
use Surfnet\StepupBundle\Exception\Art;
32
use Symfony\Bundle\FrameworkBundle\Controller\Controller as FrameworkController;
33
use Symfony\Component\HttpFoundation\Request;
34
use Symfony\Component\HttpFoundation\Response;
35
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
36
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
37
use Symfony\Component\Security\Core\Exception\AuthenticationException;
38
use Symfony\Component\Translation\TranslatorInterface;
39
40
/**
41
 * @package Surfnet\StepupBundle\Controller
42
 *
43
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) Contains extensive mapping for exceptions
44
 */
45
class ExceptionController extends FrameworkController
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
46
{
47
    public function showAction(Request $request, Exception $exception)
48
    {
49
        $statusCode = $this->getStatusCode($exception);
50
51
        if ($statusCode == 404) {
52
            $template = 'SurfnetStepupBundle:Exception:error404.html.twig';
53
        } else {
54
            $template = 'SurfnetStepupBundle:Exception:error.html.twig';
55
        }
56
57
        $response = new Response('', $statusCode);
58
59
        $timestamp = (new DateTime)->format(DateTime::ISO8601);
60
        $hostname  = $request->getHost();
61
        $requestId = $this->get('surfnet_stepup.request.request_id');
62
        $errorCode = Art::forException($exception);
63
        $userAgent = $request->headers->get('User-Agent');
64
        $ipAddress = $request->getClientIp();
65
66
        return $this->render(
67
            $template,
68
            [
69
                'timestamp'   => $timestamp,
70
                'hostname'    => $hostname,
71
                'request_id'  => $requestId->get(),
72
                'error_code'  => $errorCode,
73
                'user_agent'  => $userAgent,
74
                'ip_address'  => $ipAddress,
75
            ] + $this->getPageTitleAndDescription($exception),
76
            $response
77
        );
78
    }
79
80
    /**
81
     * @param Exception $exception
82
     * @return int HTTP status code
83
     */
84
    protected function getStatusCode(Exception $exception)
85
    {
86
        if ($exception instanceof AuthenticationException ||
0 ignored issues
show
The class Symfony\Component\Securi...AuthenticationException does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
87
            $exception instanceof InvalidResponseException) {
88
            return Response::HTTP_UNAUTHORIZED;
89
        }
90
91
        if ($exception instanceof AccessDeniedException ||
0 ignored issues
show
The class Symfony\Component\Securi...n\AccessDeniedException does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
92
            $exception instanceof PreconditionNotMetException) {
93
            return Response::HTTP_FORBIDDEN;
94
        }
95
96
        if ($exception instanceof HttpExceptionInterface) {
97
            return $exception->getStatusCode();
98
        }
99
100
        // Unknown exceptions are server errors!
101
        return 500;
102
    }
103
104
    /**
105
     * @param Exception $exception
106
     * @return array View parameters 'title' and 'description'
107
     */
108
    protected function getPageTitleAndDescription(Exception $exception)
109
    {
110
        $translator = $this->getTranslator();
111
112
        if ($exception instanceof SignatureValidationFailedException) {
113
            $title = $translator->trans('stepup.error.signature_validation_failed.title');
114
            $description = $translator->trans('stepup.error.signature_validation_failed.description');
115
116
        } elseif ($exception instanceof UnsignedRequestException) {
117
            $title = $translator->trans('stepup.error.unsigned_request.title');
118
            $description = $translator->trans('stepup.error.unsigned_request.description');
119
120
        } elseif ($exception instanceof UnsupportedSignatureException) {
121
            $title = $translator->trans('stepup.error.unsupported_signature.title');
122
            $description = $translator->trans('stepup.error.unsupported_signature.description');
123
124
        } elseif ($exception instanceof UnknownServiceProviderException) {
125
            $title = $translator->trans('stepup.error.unknown_service_provider.title');
126
            $description = $exception->getMessage();
127
128
        } elseif ($exception instanceof AuthnFailedSamlResponseException) {
129
            $title = $translator->trans('stepup.error.authn_failed.title');
130
            $description = $translator->trans('stepup.error.authn_failed.description');
131
132
        } elseif ($exception instanceof PreconditionNotMetException) {
133
            $title = $translator->trans('stepup.error.precondition_not_met.title');
134
            $description = $translator->trans('stepup.error.precondition_not_met.description');
135
136
        } elseif ($exception instanceof InvalidResponseException) {
137
            $title = $translator->trans('stepup.error.authentication_error.title');
138
            $description = $translator->trans('stepup.error.authentication_error.description');
139
        } elseif ($exception instanceof AuthenticationException) {
0 ignored issues
show
The class Symfony\Component\Securi...AuthenticationException does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
140
            $title = $translator->trans('stepup.error.authentication_error.title');
141
            $description = $translator->trans('stepup.error.authentication_error.description');
142
        } else {
143
            $title = $translator->trans('stepup.error.generic_error.title');
144
            $description = $translator->trans('stepup.error.generic_error.description');
145
        }
146
147
        return [
148
            'title' => $title,
149
            'description' => $description,
150
        ];
151
    }
152
153
    /**
154
     * @return TranslatorInterface
155
     */
156
    protected function getTranslator()
157
    {
158
        return $this->get('translator');
159
    }
160
}
161