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 (15)

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/Provider/Endorphin.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
namespace UserAgentParser\Provider;
3
4
use EndorphinStudio\Detector as EndorphinDetector;
5
use UserAgentParser\Exception\NoResultFoundException;
6
use UserAgentParser\Exception\PackageNotLoadedException;
7
use UserAgentParser\Model;
8
9
/**
10
 * Abstraction for piwik/device-detector
11
 *
12
 * @author Martin Keckeis <[email protected]>
13
 * @license MIT
14
 * @see https://github.com/EndorphinDetector-studio/browser-detector
15
 */
16
class Endorphin extends AbstractProvider
17
{
18
    /**
19
     * Name of the provider
20
     *
21
     * @var string
22
     */
23
    protected $name = 'Endorphin';
24
25
    /**
26
     * Homepage of the provider
27
     *
28
     * @var string
29
     */
30
    protected $homepage = 'https://github.com/endorphin-studio/browser-detector';
31
32
    /**
33
     * Composer package name
34
     *
35
     * @var string
36
     */
37
    protected $packageName = 'endorphin-studio/browser-detector';
38
39
    protected $detectionCapabilities = [
40
41
        'browser' => [
42
            'name'    => true,
43
            'version' => true,
44
        ],
45
46
        'renderingEngine' => [
47
            'name'    => false,
48
            'version' => false,
49
        ],
50
51
        'operatingSystem' => [
52
            'name'    => true,
53
            'version' => true,
54
        ],
55
56
        'device' => [
57
            'model'    => false,
58
            'brand'    => false,
59
            'type'     => true,
60
            'isMobile' => false,
61
            'isTouch'  => false,
62
        ],
63
64
        'bot' => [
65
            'isBot' => true,
66
            'name'  => true,
67
            'type'  => true,
68
        ],
69
    ];
70
71
    protected $defaultValues = [
72
73
        'general' => [
74
            '/^N\\\\A$/i',
75
        ],
76
77
        'device' => [
78
79
            'model' => [
80
                '/^Desktop/i',
81
            ],
82
        ],
83
    ];
84
85
    /**
86
     * Used for unitTests mocking
87
     *
88
     * @var EndorphinDetector\Detector
89
     */
90
    private $parser;
91
92
    /**
93
     *
94
     * @throws PackageNotLoadedException
95
     */
96 14
    public function __construct()
97
    {
98 14
        $this->checkIfInstalled();
99 14
    }
100
101
    /**
102
     *
103
     * @param  string                           $userAgent
104
     * @return EndorphinDetector\DetectorResult
105
     */
106 7
    public function getParser($userAgent)
107
    {
108 7
        if ($this->parser !== null) {
109 6
            return $this->parser;
110
        }
111
112 1
        return EndorphinDetector\Detector::analyse($userAgent);
113
    }
114
115
    /**
116
     *
117
     * @param EndorphinDetector\DetectorResult $resultRaw
118
     *
119
     * @return bool
120
     */
121 6
    private function hasResult(EndorphinDetector\DetectorResult $resultRaw)
122
    {
123 6
        if ($this->isRealResult($resultRaw->OS->getName()) === true) {
124 1
            return true;
125
        }
126
127 5
        if ($this->isRealResult($resultRaw->Browser->getName()) === true) {
128 1
            return true;
129
        }
130
131 4
        if ($this->isRealResult($resultRaw->Device->getName(), 'device', 'model') === true) {
132 1
            return true;
133
        }
134
135 3
        if ($this->isRealResult($resultRaw->Robot->getType()) === true) {
136 2
            return true;
137
        }
138
139 1
        return false;
140
    }
141
142
    /**
143
     *
144
     * @param Model\Bot               $bot
145
     * @param EndorphinDetector\Robot $resultRaw
146
     */
147 2
    private function hydrateBot(Model\Bot $bot, EndorphinDetector\Robot $resultRaw)
148
    {
149 2
        $bot->setIsBot(true);
150 2
        $bot->setName($this->getRealResult($resultRaw->getName()));
151 2
        $bot->setType($this->getRealResult($resultRaw->getType()));
152 2
    }
153
154
    /**
155
     *
156
     * @param Model\Browser             $browser
157
     * @param EndorphinDetector\Browser $resultRaw
158
     */
159 3
    private function hydrateBrowser(Model\Browser $browser, EndorphinDetector\Browser $resultRaw)
160
    {
161 3
        $browser->setName($this->getRealResult($resultRaw->getName()));
162 3
        $browser->getVersion()->setComplete($this->getRealResult($resultRaw->getVersion()));
163 3
    }
164
165
    /**
166
     *
167
     * @param Model\OperatingSystem $os
168
     * @param EndorphinDetector\OS  $resultRaw
169
     */
170 3
    private function hydrateOperatingSystem(Model\OperatingSystem $os, EndorphinDetector\OS $resultRaw)
171
    {
172 3
        $os->setName($this->getRealResult($resultRaw->getName()));
173 3
        $os->getVersion()->setComplete($this->getRealResult($resultRaw->getVersion()));
174 3
    }
175
176
    /**
177
     *
178
     * @param Model\Device             $device
179
     * @param EndorphinDetector\Device $resultRaw
180
     */
181 3
    private function hydrateDevice(Model\Device $device, EndorphinDetector\Device $resultRaw)
182
    {
183
        // $device->setModel($this->getRealResult($resultRaw->ModelName));
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
184 3
        $device->setType($this->getRealResult($resultRaw->getType()));
185 3
    }
186
187 6
    public function parse($userAgent, array $headers = [])
188
    {
189 6
        $resultRaw = $this->getParser($userAgent);
190
191
        /*
192
         * No result found?
193
         */
194 6
        if ($this->hasResult($resultRaw) !== true) {
195 1
            throw new NoResultFoundException('No result found for user agent: ' . $userAgent);
196
        }
197
198
        /*
199
         * Hydrate the model
200
         */
201 5
        $result = new Model\UserAgent($this->getName(), $this->getVersion());
202 5
        $result->setProviderResultRaw($resultRaw);
203
204
        /*
205
         * Bot detection
206
         */
207 5
        if ($this->isRealResult($resultRaw->Robot->getType()) === true) {
208 2
            $this->hydrateBot($result->getBot(), $resultRaw->Robot);
209
210 2
            return $result;
211
        }
212
213
        /*
214
         * hydrate the result
215
         */
216 3
        if ($resultRaw->Browser instanceof EndorphinDetector\Browser) {
217 3
            $this->hydrateBrowser($result->getBrowser(), $resultRaw->Browser);
218
        }
219 3
        if ($resultRaw->OS instanceof EndorphinDetector\OS) {
220 3
            $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw->OS);
221
        }
222 3
        if ($resultRaw->Device instanceof EndorphinDetector\Device) {
223 3
            $this->hydrateDevice($result->getDevice(), $resultRaw->Device);
224
        }
225
226 3
        return $result;
227
    }
228
}
229