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

Labels
Severity

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 DateTime;
5
use PackageInfo\Exception\PackageNotInstalledException;
6
use PackageInfo\Package;
7
use UserAgentParser\Exception;
8
use UserAgentParser\Exception\PackageNotLoadedException;
9
use UserAgentParser\Model;
10
11
/**
12
 * Abstraction for all providers
13
 *
14
 * @author Martin Keckeis <[email protected]>
15
 * @license MIT
16
 */
17
abstract class AbstractProvider
18
{
19
    /**
20
     * Name of the provider
21
     *
22
     * @var string
23
     */
24
    protected $name;
25
26
    /**
27
     * Homepage of the provider
28
     *
29
     * @var string
30
     */
31
    protected $homepage;
32
33
    /**
34
     * Composer package name
35
     *
36
     * @var string
37
     */
38
    protected $packageName;
39
40
    /**
41
     * Per default the provider cannot detect anything
42
     * Activate them in $detectionCapabilities
43
     *
44
     * @var array
45
     */
46
    protected $allDetectionCapabilities = [
47
        'browser' => [
48
            'name'    => false,
49
            'version' => false,
50
        ],
51
52
        'renderingEngine' => [
53
            'name'    => false,
54
            'version' => false,
55
        ],
56
57
        'operatingSystem' => [
58
            'name'    => false,
59
            'version' => false,
60
        ],
61
62
        'device' => [
63
            'model'    => false,
64
            'brand'    => false,
65
            'type'     => false,
66
            'isMobile' => false,
67
            'isTouch'  => false,
68
        ],
69
70
        'bot' => [
71
            'isBot' => false,
72
            'name'  => false,
73
            'type'  => false,
74
        ],
75
    ];
76
77
    /**
78
     * Set this in each Provider implementation
79
     *
80
     * @var array
81
     */
82
    protected $detectionCapabilities = [];
83
84
    protected $defaultValues = [
85
        'general' => [],
86
    ];
87
88
    /**
89
     * Return the name of the provider
90
     *
91
     * @return string
92
     */
93 1
    public function getName()
94
    {
95 1
        return $this->name;
96
    }
97
98
    /**
99
     * Get the homepage
100
     *
101
     * @return string
102
     */
103 1
    public function getHomepage()
104
    {
105 1
        return $this->homepage;
106
    }
107
108
    /**
109
     * Get the package name
110
     *
111
     * @return string null
112
     */
113 7
    public function getPackageName()
114
    {
115 7
        return $this->packageName;
116
    }
117
118
    /**
119
     * Return the version of the provider
120
     *
121
     * @return string null
122
     */
123 2
    public function getVersion()
124
    {
125
        try {
126 2
            $package = new Package($this->getPackageName());
127
128 1
            return $package->getVersion();
0 ignored issues
show
The method getVersion() does not seem to exist on object<PackageInfo\Package>.

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...
129 1
        } catch (PackageNotInstalledException $ex) {
130 1
            return;
131
        }
132
    }
133
134
    /**
135
     * Get the last change date of the provider
136
     *
137
     * @return DateTime null
138
     */
139 2
    public function getUpdateDate()
140
    {
141
        try {
142 2
            $package = new Package($this->getPackageName());
143
144 1
            return $package->getVersionReleaseDate();
0 ignored issues
show
The method getVersionReleaseDate() does not seem to exist on object<PackageInfo\Package>.

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...
145 1
        } catch (PackageNotInstalledException $ex) {
146 1
            return;
147
        }
148
    }
149
150
    /**
151
     * What kind of capabilities this provider can detect
152
     *
153
     * @return array
154
     */
155 1
    public function getDetectionCapabilities()
156
    {
157 1
        return array_merge($this->allDetectionCapabilities, $this->detectionCapabilities);
158
    }
159
160
    /**
161
     *
162
     * @throws PackageNotLoadedException
163
     */
164 2
    protected function checkIfInstalled()
165
    {
166 2
        if (! Package::isInstalled($this->getPackageName())) {
167 1
            throw new PackageNotLoadedException('You need to install the package ' . $this->getPackageName() . ' to use this provider');
168
        }
169 1
    }
170
171
    /**
172
     *
173
     * @param  mixed   $value
174
     * @param  string  $group
175
     * @param  string  $part
176
     * @return boolean
177
     */
178 4
    protected function isRealResult($value, $group = null, $part = null)
179
    {
180 4
        $value = (string) $value;
181 4
        $value = trim($value);
182
183 4
        if ($value === '') {
184 2
            return false;
185
        }
186
187 4
        $regexes = $this->defaultValues['general'];
188
189 4
        if ($group !== null && $part !== null && isset($this->defaultValues[$group][$part])) {
190 2
            $regexes = array_merge($regexes, $this->defaultValues[$group][$part]);
191
        }
192
193 4
        foreach ($regexes as $regex) {
194 2
            if (preg_match($regex, $value) === 1) {
195 2
                return false;
196
            }
197
        }
198
199 4
        return true;
200
    }
201
202 2
    protected function getRealResult($value, $group = null, $part = null)
203
    {
204 2
        if ($this->isRealResult($value, $group, $part) === true) {
205 2
            return $value;
206
        }
207
208 2
        return;
209
    }
210
211
    /**
212
     * Parse the given user agent and return a result if possible
213
     *
214
     * @param string $userAgent
215
     * @param array  $headers
216
     *
217
     * @throws Exception\NoResultFoundException
218
     *
219
     * @return Model\UserAgent
220
     */
221
    abstract public function parse($userAgent, array $headers = []);
222
}
223