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

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/Saltwater/Salt/Module.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 Saltwater\Salt;
4
5
use Saltwater\Server as S;
6
use Saltwater\Utils as U;
7
use Saltwater\Salt\Provider;
8
9
/**
10
 * Modules encapsulate salts
11
 *
12
 * @package Saltwater\Salt
13
 */
14
class Module
15
{
16
    /** @var string Can be used to override the automatically generated value */
17
    public static $name;
18
19
    /** @var string Can be used to override the automatically generated value */
20
    public static $namespace;
21
22
    /**
23
     * @var array Requirements that need to be in place for this module
24
     */
25
    protected $require = array();
26
27
    /**
28
     * @var array Salts that this module provides
29
     */
30
    protected $provide = array();
31
32
    /**
33
     * @var int bitmask of Salts passed to the registry
34
     */
35
    public $registry = 0;
36
37
    /**
38
     * @param string $name
39
     *
40
     * @return void
41
     */
42
    public function register($name)
43
    {
44
        $name = 'module.' . $name;
45
46
        if (S::$n->registry->exists($name) || $this->registry) {
47
            return;
48
        }
49
50
        $this->ensureRequires();
51
52
        $this->registry |= S::$n->registry->append($name);
53
54
        $this->registerProvides();
55
    }
56
57
    /**
58
     * Make sure all required modules are loaded
59
     *
60
     * @return void
61
     */
62
    private function ensureRequires()
63
    {
64
        if (empty($this->require['module'])) {
65
            return;
66
        }
67
68
        foreach ($this->require['module'] as $module) {
69
            S::$n->modules->append($module, true);
70
        }
71
    }
72
73
    /**
74
     * Register all salts the module provides
75
     *
76
     * @return void
77
     */
78
    private function registerProvides()
79
    {
80
        if (empty($this->provide)) {
81
            return;
82
        }
83
84
        foreach ($this->provide as $type => $content) {
85
            foreach ($content as $salt) {
86
                $this->registerProvide($type, $salt);
87
            }
88
        }
89
    }
90
91
    /**
92
     * Register a salt that this module provides
93
     *
94
     * @param $type
95
     * @param $salt
96
     *
97
     * @return void
98
     */
99
    private function registerProvide($type, $salt)
100
    {
101
        $this->registry |= S::$n->registry->append(
102
            $type . '.' . U::camelTodashed($salt)
103
        );
104
    }
105
106
    /**
107
     * Check whether the module contains a salt
108
     *
109
     * @param $bit
110
     *
111
     * @return bool
112
     */
113
    public function has($bit)
114
    {
115
        return ($this->registry & $bit) == $bit;
116
    }
117
118
    /**
119
     * Create a new provider instance
120
     *
121
     * @param string $type
122
     * @param string $caller
123
     *
124
     * @return Provider
125
     */
126
    public function provider($caller, $type)
127
    {
128
        $class = $this->makeProvider($type);
129
130
        if ($class === false) {
131
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return false; (false) is incompatible with the return type documented by Saltwater\Salt\Module::provider of type Saltwater\Salt\Provider.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
132
        }
133
134
        $class::setModule($this::getName());
135
136
        $class::setCaller($caller);
137
138
        return new $class;
139
    }
140
141
    /**
142
     * @param string $type
143
     *
144
     * @return false|Provider
145
     */
146
    private function makeProvider($type)
147
    {
148
        $class = U::className($this::getNamespace(), 'provider', $type);
149
150
        return class_exists($class) ? $class : false;
151
    }
152
153
    /**
154
     * Check whether this module provides a salt
155
     *
156
     * @return bool
157
     */
158
    public function doesProvide($salt)
159
    {
160
        return !empty($this->provide[$salt]);
161
    }
162
163
    /**
164
     * Return the master context for this module
165
     *
166
     * @return null|string
167
     */
168
    public function masterContext()
169
    {
170
        if (!$this->doesProvide('context')) {
171
            return null;
172
        }
173
174
        return U::camelTodashed($this->provide['context'][0]);
175
    }
176
177
    /**
178
     * @return string
179
     */
180
    public static function getName()
181
    {
182
        $class = get_called_class();
183
184
        if (!empty($class::$name)) {
185
            return $class::$name;
186
        }
187
188
        return U::namespacedClassToDashed($class);
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public static function getNamespace()
195
    {
196
        $class = get_called_class();
197
198
        if (!empty($class::$namespace)) {
199
            return $class::$namespace;
200
        }
201
202
        return U::namespaceFromClass($class);
203
    }
204
}
205