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

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.

src/UserAgentParser.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
 * (c) 2008 Dejan Spasic <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @package    Util
9
 * @author     Dejan Spasic <[email protected]>
10
 * @version    GIT: $Id:$
11
 */
12
13
namespace Fam\Util;
14
15
use Fam\Util\UserAgentParser\OperatingSystem;
16
use Fam\Util\UserAgentParser\UndefinedOperatingSystem;
17
use Fam\Util\UserAgentParser\UndefinedWebClient;
18
use Fam\Util\UserAgentParser\UserAgent;
19
use Fam\Util\UserAgentParser\WebClient;
20
21
/**
22
 * A lightweight and fast browser detector
23
 *
24
 * Sniffs the operating system, web client name and web client version from
25
 * environment HTTP_USER_AGENT.
26
 *
27
 * <code>
28
 *   $userAgent = UserAgentParser::createInstance()->parseUserAgent($_SERVER['HTTP_USER_AGENT']);
29
 *
30
 *   if ($userAgent->isWebClient('firefox')) {
31
 *       if (UserAgentParser::isWebClientVersionBetween(9.5, 9.6)) {
32
 *          echo 'firefox between 95 and 96';
33
 *       }
34
 *       else if (UserAgentParser::isWebClientVersionBetween(9.2, 9.4)) {
35
 *          echo 'firefox between 92 and 94';
36
 *       }
37
 *   }
38
 *
39
 *   if ($userAgent->isOs('macintosh')) {
40
 *      echo 'Mac';
41
 *   }
42
 * </code>
43
 *
44
 * @package    Util
45
 * @author     Dejan Spasic <[email protected]>
46
 * @version    @@PACKAGE_VERSION@@
47
 */
48
class UserAgentParser
49
{
50
    /**
51
     * @var string
52
     */
53
    private $userAgent = null;
54
55
    /**
56
     * @var array
57
     */
58
    private $operatingSystems = array();
59
60
    /**
61
     * @var array
62
     */
63
    private $webClients = array();
64
65
    /**
66
     * @var OperatingSystem
67
     */
68
    private $undefinedOperatingSystem;
69
70
    /**
71
     * @var OperatingSystem
72
     */
73
    private $undefinedWebClient;
74
75 14
    public function __construct()
76
    {
77 14
        $this->undefinedOperatingSystem = new UndefinedOperatingSystem();
78 14
        $this->undefinedWebClient = new UndefinedWebClient();
79 14
    }
80
81 2
    public static function createInstance(): self
82
    {
83 2
        $self = new static();
84 2
        $self->initializeCommonOperatingSystems();
85 2
        $self->initializeCommonWebClients();
86
87 2
        return $self;
88
    }
89
90 2
    private function initializeCommonOperatingSystems(): void
91
    {
92 2
        $this->addOperatingSystem(new UserAgentParser\Windows());
93 2
        $this->addOperatingSystem(new UserAgentParser\Macintosh());
94 2
        $this->addOperatingSystem(new UserAgentParser\Unix());
95 2
    }
96
97 2
    private function initializeCommonWebClients(): void
98
    {
99 2
        $this->addWebClient(new UserAgentParser\Firefox());
100 2
        $this->addWebClient(new UserAgentParser\Opera());
101 2
        $this->addWebClient(new UserAgentParser\Safari());
102 2
        $this->addWebClient(new UserAgentParser\InternetExplorer());
103 2
    }
104
105 4
    public function parseUserAgent(string $userAgent): UserAgent
106
    {
107 4
        $this->userAgent = $userAgent;
108
109 4
        return new UserAgent($this->parseOs(), $this->parseWebClient());
110
    }
111
112
    /**
113
     * @return OperatingSystem
114
     */
115 4
    private function parseOs(): OperatingSystem
116
    {
117 4
        foreach ($this->operatingSystems as $currentOs) {
118 2
            if ($currentOs->match($this->userAgent)) {
119 2
                return $currentOs;
120
            }
121
        }
122
123 3
        return $this->undefinedOperatingSystem;
124
    }
125
126 4
    private function parseWebClient(): WebClient
127
    {
128 4
        foreach ($this->webClients as $currentWebClient) {
129 1
            if ($currentWebClient->match($this->userAgent)) {
130 1
                return $currentWebClient;
131
            }
132
        }
133
134 3
        return $this->undefinedWebClient;
135
    }
136
137 7
    public function addOperatingSystem(OperatingSystem $operatingSystem)
138
    {
139 7
        $this->operatingSystems[get_class($operatingSystem)] = $operatingSystem;
140 7
    }
141
142 1
    public function removeOperatingSystem(OperatingSystem $operatingSystem)
143
    {
144 1
        $this->removeOperatingSystemByClassName(get_class($operatingSystem));
145 1
    }
146
147 2
    public function removeOperatingSystemByClassName(string $operatingSystem)
148
    {
149 2
        unset($this->operatingSystems[$operatingSystem]);
150 2
    }
151
152 4
    public function getOperatingSystems(): array
153
    {
154 4
        return $this->operatingSystems;
155
    }
156
157 1
    public function getUndefinedOperatingSystem(): OperatingSystem
158
    {
159 1
        return $this->undefinedOperatingSystem;
160
    }
161
162 2
    public function setUndefinedOperatingSystem(OperatingSystem $operatingSystem)
163
    {
164 2
        $this->undefinedOperatingSystem = $operatingSystem;
165 2
    }
166
167 6
    public function addWebClient(WebClient $webClient): void
168
    {
169 6
        $this->webClients[get_class($webClient)] = $webClient;
170 6
    }
171
172 1
    public function removeWebClient(WebClient $webClient): void
173
    {
174 1
        $this->removeWebClientByClassName(get_class($webClient));
175 1
    }
176
177 2
    public function removeWebClientByClassName(string $webClient)
178
    {
179 2
        unset($this->webClients[$webClient]);
180 2
    }
181
182 4
    public function getWebClients(): array
183
    {
184 4
        return $this->webClients;
185
    }
186
187 1
    public function getUndefinedWebClient(): WebClient
188
    {
189 1
        return $this->undefinedWebClient;
190
    }
191
192 2
    public function setUndefinedWebClient(WebClient $webClient): void
193
    {
194 2
        $this->undefinedWebClient = $webClient;
0 ignored issues
show
Documentation Bug introduced by
It seems like $webClient of type object<Fam\Util\UserAgentParser\WebClient> is incompatible with the declared type object<Fam\Util\UserAgentParser\OperatingSystem> of property $undefinedWebClient.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
195 2
    }
196
}
197