Issues (5)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/DiscoPower.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Module\discopower\Controller;
6
7
use Exception;
8
use SimpleSAML\Error;
9
use SimpleSAML\Module\discopower\PowerIdPDisco;
10
use SimpleSAML\Session;
11
use Symfony\Component\HttpFoundation\{JsonResponse, Request, Response, StreamedResponse};
12
13
class DiscoPower
14
{
15
    /**
16
     * @param \Symfony\Component\HttpFoundation\Request $request The current request.
17
     * @return \Symfony\Component\HttpFoundation\StreamedResponse
18
     */
19
    public function main(Request $request): StreamedResponse
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    public function main(/** @scrutinizer ignore-unused */ Request $request): StreamedResponse

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    {
21
        try {
22
            $discoHandler = new PowerIdPDisco(
23
                ['saml20-idp-remote'],
24
                'poweridpdisco',
25
            );
26
        } catch (Exception $exception) {
27
            // An error here should be caused by invalid query parameters
28
            throw new Error\Error('DISCOPARAMS', $exception);
29
        }
30
31
        try {
32
            return new StreamedResponse([$discoHandler, 'handleRequest']);
33
        } catch (Exception $exception) {
34
            // An error here should be caused by metadata
35
            throw new Error\Error('METADATA', $exception);
36
        }
37
    }
38
39
    /**
40
     * An AJAX handler to retrieve a list of disco tabs from the session.
41
     * This allows us to dynamically update the tab list without inline javascript.
42
     *
43
     * @param \Symfony\Component\HttpFoundation\Request $request The current request.
44
     */
45
    public function tablist(Request $request): Response
46
    {
47
        $session = Session::getSessionFromRequest();
48
        $tabs = $session->getData('discopower:tabList', 'tabs');
49
        $faventry = $session->getData('discopower:tabList', 'faventry');
50
        $defaulttab = $session->getData('discopower:tabList', 'defaulttab');
51
52
        if (!is_array($tabs)) {
53
            throw new Error\Exception('Could not get tab list from session');
54
        }
55
56
        $response = new JsonResponse();
57
58
        // handle JSONP requests
59
        if ($request->query->has('callback')) {
60
            $callback = $request->query->get('callback');
61
            if (!preg_match('/^[a-z0-9_]+$/i', $callback)) {
62
                throw new Error\Exception('Unsafe JSONP callback function name ' . var_export($callback, true));
63
            }
64
            $response->setCallback($callback);
65
        }
66
67
        $response->setData(
68
            [
69
                'faventry' => $faventry,
70
                'default' => $defaulttab,
71
                'tabs' => $tabs,
72
            ],
73
        );
74
        return $response;
75
    }
76
}
77