Issues (22)

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/Base/BaseController.php (2 issues)

1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Controller\Base;
13
14
use App\Entity\User;
15
use App\Security\UserToken;
16
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
17
use Symfony\Component\HttpFoundation\Session\SessionInterface;
18
19
class BaseController extends AbstractController
20
{
21
    /**
22
     * @return User|null
23
     */
24
    protected function getUser()
25
    {
26
        $token = $this->container->get('security.token_storage')->getToken();
27
28
        if (!($token instanceof UserToken)) {
29
            return null;
30
        }
31
32
        $userRepository = $this->getDoctrine()->getRepository(User::class);
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Bundle\Framework...ntroller::getDoctrine() has been deprecated: since Symfony 5.4, inject an instance of ManagerRegistry in your controller instead ( Ignorable by Annotation )

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

32
        $userRepository = /** @scrutinizer ignore-deprecated */ $this->getDoctrine()->getRepository(User::class);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

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

Loading history...
33
34
        return $userRepository->findOneBy(['email' => $token->getUser()]);
35
    }
36
37
    public static function getSubscribedServices()
38
    {
39
        return parent::getSubscribedServices() + ['session' => '?'.SessionInterface::class];
40
    }
41
42
    /**
43
     * @param string $message the translation message to display
44
     * @param string $link
45
     */
46
    protected function displayError($message, $link = null)
47
    {
48
        $this->displayFlash('danger', $message, $link);
49
    }
50
51
    /**
52
     * @param string $message the translation message to display
53
     * @param string $link
54
     */
55
    protected function displaySuccess($message, $link = null)
56
    {
57
        $this->displayFlash('success', $message, $link);
58
    }
59
60
    /**
61
     * @param string $message the translation message to display
62
     * @param string $link
63
     */
64
    protected function displayDanger($message, $link = null)
65
    {
66
        $this->displayFlash('danger', $message, $link);
67
    }
68
69
    /**
70
     * @param string $message the translation message to display
71
     * @param string $link
72
     */
73
    protected function displayInfo($message, $link = null)
74
    {
75
        $this->displayFlash('info', $message, $link);
76
    }
77
78
    /**
79
     * @param $type
80
     * @param $message
81
     * @param string $link
82
     */
83
    private function displayFlash($type, $message, $link = null)
84
    {
85
        if (null !== $link) {
86
            $message = '<a href="'.$link.'">'.$message.'</a>';
87
        }
88
        $this->get('session')->getFlashBag()->set($type, $message);
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Bundle\Framework...stractController::get() has been deprecated: since Symfony 5.4, use method or constructor injection in your controller instead ( Ignorable by Annotation )

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

88
        /** @scrutinizer ignore-deprecated */ $this->get('session')->getFlashBag()->set($type, $message);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

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

Loading history...
89
    }
90
}
91