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

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 HandsetDetection as Parser;
5
use UserAgentParser\Exception\InvalidArgumentException;
6
use UserAgentParser\Exception\NoResultFoundException;
7
use UserAgentParser\Model;
8
9
/**
10
 * Abstraction for ua-parser/uap-php
11
 *
12
 * @author Martin Keckeis <[email protected]>
13
 * @license MIT
14
 * @see https://github.com/HandsetDetection/php-apikit
15
 */
16
class HandsetDetection extends AbstractProvider
17
{
18
    /**
19
     * Name of the provider
20
     *
21
     * @var string
22
     */
23
    protected $name = 'HandsetDetection';
24
25
    /**
26
     * Homepage of the provider
27
     *
28
     * @var string
29
     */
30
    protected $homepage = 'https://github.com/HandsetDetection/php-apikit';
31
32
    /**
33
     * Composer package name
34
     *
35
     * @var string
36
     */
37
    protected $packageName = 'handsetdetection/php-apikit';
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'    => true,
58
            'brand'    => true,
59
            'type'     => false,
60
            'isMobile' => false,
61
            'isTouch'  => false,
62
        ],
63
64
        'bot' => [
65
            'isBot' => false,
66
            'name'  => false,
67
            'type'  => false,
68
        ],
69
    ];
70
71
    protected $defaultValues = [
72
73
        'general' => [
74
            '/^generic$/i',
75
        ],
76
77
        'device' => [
78
            'model' => [
79
                '/analyzer/i',
80
                '/bot/i',
81
                '/crawler/i',
82
                '/library/i',
83
                '/spider/i',
84
            ],
85
        ],
86
    ];
87
88
    /**
89
     *
90
     * @var Parser\HD4
91
     */
92
    private $parser;
93
94
    /**
95
     *
96
     * @param Parser\HD4 $parser
97
     */
98 13
    public function __construct(Parser\HD4 $parser)
99
    {
100 13
        $this->parser = $parser;
101 13
    }
102
103
    /**
104
     *
105
     * @return Parser\HD4
106
     */
107 6
    public function getParser()
108
    {
109 6
        return $this->parser;
110
    }
111
112
    /**
113
     *
114
     * @param array $resultRaw
115
     *
116
     * @return bool
117
     */
118 5
    private function hasResult(array $resultRaw)
119
    {
120 5
        if (isset($resultRaw['general_browser']) && $this->isRealResult($resultRaw['general_browser'])) {
121 2
            return true;
122
        }
123
124 3
        if (isset($resultRaw['general_platform']) && $this->isRealResult($resultRaw['general_platform'])) {
125 1
            return true;
126
        }
127
128 2
        if (isset($resultRaw['general_model']) && $this->isRealResult($resultRaw['general_model'], 'device', 'model') && $this->isRealResult($resultRaw['general_vendor'], 'device', 'brand')) {
129 1
            return true;
130
        }
131
132 1
        return false;
133
    }
134
135
    /**
136
     *
137
     * @param Model\Browser $browser
138
     * @param array         $resultRaw
139
     */
140 4
    private function hydrateBrowser(Model\Browser $browser, array $resultRaw)
141
    {
142 4
        if (isset($resultRaw['general_browser'])) {
143 2
            $browser->setName($this->getRealResult($resultRaw['general_browser']));
144
        }
145 4
        if (isset($resultRaw['general_browser_version'])) {
146 2
            $browser->getVersion()->setComplete($this->getRealResult($resultRaw['general_browser_version']));
147
        }
148 4
    }
149
150
    /**
151
     *
152
     * @param Model\OperatingSystem $os
153
     * @param array                 $resultRaw
154
     */
155 4
    private function hydrateOperatingSystem(Model\OperatingSystem $os, array $resultRaw)
156
    {
157 4
        if (isset($resultRaw['general_platform'])) {
158 1
            $os->setName($this->getRealResult($resultRaw['general_platform']));
159
        }
160 4
        if (isset($resultRaw['general_platform_version'])) {
161 1
            $os->getVersion()->setComplete($this->getRealResult($resultRaw['general_platform_version']));
162
        }
163 4
    }
164
165
    /**
166
     *
167
     * @param Model\UserAgent $device
168
     * @param array           $resultRaw
169
     */
170 4
    private function hydrateDevice(Model\Device $device, array $resultRaw)
171
    {
172 4
        if (isset($resultRaw['general_model']) && $this->isRealResult($resultRaw['general_model'], 'device', 'model') && isset($resultRaw['general_vendor']) && $this->isRealResult($resultRaw['general_vendor'], 'device', 'brand')) {
173 1
            $device->setModel($this->getRealResult($resultRaw['general_model'], 'device', 'model'));
174 1
            $device->setBrand($this->getRealResult($resultRaw['general_vendor'], 'device', 'brand'));
175
        }
176 4
    }
177
178 6
    public function parse($userAgent, array $headers = [])
179
    {
180 6
        $headers['User-Agent'] = $userAgent;
181
182 6
        $parser = $this->getParser();
183
        // $config = $parser->config;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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
185
        // $parser = new Parser\HD4($config);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
186
187
        /*
188
         * No result found?
189
         */
190 6
        $result    = $parser->deviceDetect($headers);
191 6
        $resultRaw = $parser->getReply();
192
193 6
        if ($result !== true) {
194 1
            if (isset($resultRaw['status']) && $resultRaw['status'] == '299') {
195
                throw new InvalidArgumentException('You need to warm-up the cache first to use this provider');
196
            }
197
198 1
            throw new NoResultFoundException('No result found for user agent: ' . $userAgent);
199
        }
200
201
        /*
202
         * No result found?
203
         */
204 5
        if (! isset($resultRaw['hd_specs']) || $this->hasResult($resultRaw['hd_specs']) !== true) {
205 1
            throw new NoResultFoundException('No result found for user agent: ' . $userAgent);
206
        }
207
208
        /*
209
         * Hydrate the model
210
         */
211 4
        $result = new Model\UserAgent($this->getName(), $this->getVersion());
212 4
        $result->setProviderResultRaw($resultRaw['hd_specs']);
213
214
        /*
215
         * hydrate the result
216
         */
217 4
        $this->hydrateBrowser($result->getBrowser(), $resultRaw['hd_specs']);
218
        // renderingEngine not available
219 4
        $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw['hd_specs']);
220 4
        $this->hydrateDevice($result->getDevice(), $resultRaw['hd_specs']);
221
222 4
        return $result;
223
    }
224
}
225