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    no request data  

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.

MagentoExtension/Listener/ModuleUpdateListener.php (1 issue)

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
namespace MageTest\PhpSpec\MagentoExtension\Listener;
4
5
use MageTest\PhpSpec\MagentoExtension\CodeGenerator\Generator\Xml\ConfigGenerator;
6
use MageTest\PhpSpec\MagentoExtension\CodeGenerator\Generator\Xml\ModuleGenerator;
7
use MageTest\PhpSpec\MagentoExtension\CodeGenerator\Generator\Xml\XmlGeneratorException;
8
use MageTest\PhpSpec\MagentoExtension\Util\ClassDetector;
9
use PhpSpec\Console\ConsoleIO as IO;
10
use PhpSpec\Event\ExampleEvent;
11
use PhpSpec\Event\SuiteEvent;
12
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13
use PhpSpec\Exception\Fracture\ClassNotFoundException as PhpSpecClassException;
14
use Prophecy\Exception\Doubler\ClassNotFoundException as ProphecyClassException;
15
16
class ModuleUpdateListener implements EventSubscriberInterface
17
{
18
    /**
19
     * @var array
20
     */
21
    private $classNames = array();
22
23
    /**
24
     * @var ModuleGenerator
25
     */
26
    private $moduleGenerator;
27
28
    /**
29
     * @var ConfigGenerator
30
     */
31
    private $configGenerator;
32
33
    /**
34
     * @var IO
35
     */
36
    private $io;
37
38
    /**
39
     * @var ClassDetector
40
     */
41
    private $detector;
42
43
    /**
44
     * @param ModuleGenerator $moduleGenerator
45
     * @param ConfigGenerator $configGenerator
46
     * @param IO $io
47
     * @param ClassDetector $detector
48
     */
49
    public function __construct(
50
        ModuleGenerator $moduleGenerator,
51
        ConfigGenerator $configGenerator,
52
        IO $io,
53
        ClassDetector $detector
54
    ) {
55
        $this->moduleGenerator = $moduleGenerator;
56
        $this->configGenerator = $configGenerator;
57
        $this->io = $io;
58
        $this->detector = $detector;
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public static function getSubscribedEvents()
65
    {
66
        return array(
67
            'afterExample' => array('getClassNameAfterExample', 10),
68
            'afterSuite'   => array('createXmlAfterSuite', -20),
69
        );
70
    }
71
72
    /**
73
     * @param ExampleEvent $event
74
     */
75
    public function getClassNameAfterExample(ExampleEvent $event)
76
    {
77
        $exception = $event->getException();
78
79
        if ($this->exceptionIsNotUsable($exception)) {
80
            return;
81
        }
82
83
        $className = $exception->getClassname();
84
85
        if (strlen($className)) {
86
            $parts = explode('_', $className);
87
            if (!isset($parts[0]) || !isset($parts[1])) {
88
                return;
89
            }
90
            $this->classNames[$className] = $parts[0] . '_' . $parts[1];
91
        }
92
    }
93
94
    /**
95
     * @param SuiteEvent $event
96
     */
97
    public function createXmlAfterSuite(SuiteEvent $event)
0 ignored issues
show
The parameter $event 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...
98
    {
99
        if (!$this->io->isCodeGenerationEnabled()) {
100
            return;
101
        }
102
103
        foreach ($this->classNames as $className => $moduleName) {
104
            if (!$this->detector->classExists($className)) {
105
                continue;
106
            }
107
108
            $this->moduleGenerator->generate(($moduleName));
109
110
            $this->configGenerator->generateElement(
111
                $this->getClassType($className),
112
                $moduleName
113
            );
114
        }
115
    }
116
117
    /**
118
     * @param string $className
119
     * @return string
120
     */
121
    private function getClassType($className)
122
    {
123
        $parts = explode('_', $className);
124
        if (!isset($parts[2])) {
125
            throw new XmlGeneratorException('Could not determine an object type from ' . $className);
126
        }
127
        if ($this->partIsController($parts[count($parts)-1])) {
128
            return 'controller';
129
        }
130
        return strtolower($parts[2]);
131
    }
132
133
    /**
134
     * @param string $part
135
     * @return bool
136
     */
137
    private function partIsController($part)
138
    {
139
        $element = 'Controller';
140
        return strlen($part) - strlen($element) === strrpos($part, $element);
141
    }
142
143
    /**
144
     * @param \Exception $exception
145
     * @return bool
146
     */
147
    protected function exceptionIsNotUsable($exception)
148
    {
149
        if (null === $exception) {
150
            return true;
151
        }
152
153
        if (!($exception instanceof PhpSpecClassException || $exception instanceof ProphecyClassException)) {
154
            return true;
155
        }
156
157
        return false;
158
    }
159
}
160