Issues (196)

Security Analysis    6 potential vulnerabilities

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 (4)
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 (1)
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.
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/BlameController.php (2 issues)

Labels
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller;
6
7
use App\Model\Authorship;
8
use App\Model\Blame;
9
use App\Repository\BlameRepository;
10
use Symfony\Component\HttpFoundation\Response;
11
use Symfony\Component\Routing\Annotation\Route;
12
13
/**
14
 * This controller provides the search form and results page for the Blame tool.
15
 * @codeCoverageIgnore
16
 */
17
class BlameController extends XtoolsController
18
{
19
    /**
20
     * @inheritDoc
21
     * @codeCoverageIgnore
22
     */
23
    public function getIndexRoute(): string
24
    {
25
        return 'Blame';
26
    }
27
28
    /**
29
     * @inheritDoc
30
     * @codeCoverageIgnore
31
     */
32
    public function supportedProjects(): array
33
    {
34
        return Authorship::SUPPORTED_PROJECTS;
35
    }
36
37
    /**
38
     * The search form.
39
     * @Route("/blame", name="Blame")
40
     * @Route("/blame/{project}", name="BlameProject")
41
     * @return Response
42
     */
43
    public function indexAction(): Response
44
    {
45
        $this->params['target'] = $this->request->query->get('target', '');
46
47
        if (isset($this->params['project']) && isset($this->params['page']) && isset($this->params['q'])) {
48
            return $this->redirectToRoute('BlameResult', $this->params);
49
        }
50
51
        if (preg_match('/\d{4}-\d{2}-\d{2}/', $this->params['target'])) {
52
            $show = 'date';
53
        } elseif (is_numeric($this->params['target'])) {
54
            $show = 'id';
55
        } else {
56
            $show = 'latest';
57
        }
58
59
        return $this->render('blame/index.html.twig', array_merge([
60
            'xtPage' => 'Blame',
61
            'xtPageTitle' => 'tool-blame',
62
            'xtSubtitle' => 'tool-blame-desc',
63
64
            // Defaults that will get overridden if in $params.
65
            'page' => '',
66
            'supportedProjects' => Authorship::SUPPORTED_PROJECTS,
67
        ], $this->params, [
68
            'project' => $this->project,
69
            'show' => $show,
70
            'target' => '',
71
        ]));
72
    }
73
74
    /**
75
     * @Route(
76
     *     "/blame/{project}/{page}/{target}",
77
     *     name="BlameResult",
78
     *     requirements={
79
     *         "page"="(.+?)",
80
     *         "target"="|latest|\d+|\d{4}-\d{2}-\d{2}",
81
     *     },
82
     *     defaults={"target"="latest"}
83
     * )
84
     * @param string $target
85
     * @param BlameRepository $blameRepo
86
     * @return Response
87
     */
88
    public function resultAction(string $target, BlameRepository $blameRepo): Response
89
    {
90
        if (!isset($this->params['q'])) {
91
            return $this->redirectToRoute('BlameProject', [
92
                'project' => $this->project->getDomain(),
93
            ]);
94
        }
95
        if (0 !== $this->page->getNamespace()) {
0 ignored issues
show
The method getNamespace() does not exist on null. ( Ignorable by Annotation )

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

95
        if (0 !== $this->page->/** @scrutinizer ignore-call */ getNamespace()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
96
            $this->addFlashMessage('danger', 'error-authorship-non-mainspace');
97
            return $this->redirectToRoute('BlameProject', [
98
                'project' => $this->project->getDomain(),
99
            ]);
100
        }
101
102
        // This action sometimes requires more memory. 256M should be safe.
103
        ini_set('memory_limit', '256M');
104
105
        $blame = new Blame($blameRepo, $this->page, $this->params['q'], $target);
0 ignored issues
show
It seems like $this->page can also be of type null; however, parameter $page of App\Model\Blame::__construct() does only seem to accept App\Model\Page, maybe add an additional type check? ( Ignorable by Annotation )

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

105
        $blame = new Blame($blameRepo, /** @scrutinizer ignore-type */ $this->page, $this->params['q'], $target);
Loading history...
106
        $blame->setRepository($blameRepo);
107
        $blame->prepareData();
108
109
        return $this->getFormattedResponse('blame/blame', [
110
            'xtPage' => 'Blame',
111
            'xtTitle' => $this->page->getTitle(),
112
            'blame' => $blame,
113
        ]);
114
    }
115
}
116