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/Service.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
3
namespace Saltwater\Salt;
4
5
use Saltwater\Server as S;
6
7
/**
8
 * Services encapsulate application logic
9
 *
10
 * @package Saltwater\Salt
11
 */
12
class Service
13
{
14
    /** @var Context */
15
    protected $context = null;
16
17
    /** @var string */
18
    protected $module = null;
19
20
    /**
21
     * @param Context $context
22
     * @param string  $module
23
     *
24
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
25
     */
26
    public function __construct($context = null, $module = null)
27
    {
28
        $this->setContext($context);
0 ignored issues
show
It seems like $context defined by parameter $context on line 26 can be null; however, Saltwater\Salt\Service::setContext() does not accept null, maybe add an additional type check?

It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.

We recommend to add an additional type check (or disallow null for the parameter):

function notNullable(stdClass $x) { }

// Unsafe
function withoutCheck(stdClass $x = null) {
    notNullable($x);
}

// Safe - Alternative 1: Adding Additional Type-Check
function withCheck(stdClass $x = null) {
    if ($x instanceof stdClass) {
        notNullable($x);
    }
}

// Safe - Alternative 2: Changing Parameter
function withNonNullableParam(stdClass $x) {
    notNullable($x);
}
Loading history...
29
30
        if (is_null($module) && !empty($context->module)) {
31
            $module = $context->module->getName();
32
        }
33
34
        $this->setModule($module);
35
    }
36
37
    /**
38
     * @param Context $context
39
     *
40
     * @return void
41
     */
42
    public function setContext($context)
43
    {
44
        $this->context = $context;
45
    }
46
47
    /**
48
     * @param string $module
49
     *
50
     * @return void
51
     */
52
    public function setModule($module)
53
    {
54
        $this->module = $module;
55
    }
56
57
    /**
58
     * Ensure that a method can be called within this service
59
     *
60
     * @param string $method
61
     *
62
     * @return bool
63
     */
64
    public function isCallable($method)
65
    {
66
        return method_exists($this, $method);
67
    }
68
69
    /**
70
     * Prepare the calling of a method
71
     *
72
     * @param object $call
73
     *
74
     * @return bool
75
     */
76
    public function prepareCall($call)
77
    {
78
        return $this->isCallable($call->function);
79
    }
80
81
    /**
82
     * Attempt to execute a call on this service
83
     *
84
     * @param object $call
85
     * @param mixed  $data
86
     *
87
     * @return mixed
88
     */
89
    public function call($call, $data = null)
90
    {
91
        if (!$this->isCallable($call->function)) {
92
            return null;
93
        }
94
95
        return $this->executeCall($call, $call->function, $data);
96
    }
97
98
    /**
99
     * Execute a call
100
     *
101
     * @param object $call
102
     * @param string $method
103
     * @param mixed  $data
104
     *
105
     * @return mixed
106
     */
107
    protected function executeCall($call, $method, $data)
108
    {
109
        $reflect = new \ReflectionMethod($this, $method);
110
111
        // Check whether we need to inject parameters
112
        if ($reflect->getNumberOfParameters()) {
113
            return call_user_func_array(
114
                array($this, $method),
115
                $this->getMethodArgs($reflect, $call->path, $data)
116
            );
117
        }
118
119
        // No parameter assembly necessary
120
        return call_user_func(array($this, $method));
121
    }
122
123
    /**
124
     * Assemble injected method parameters
125
     *
126
     * Note: $path and $data are reserved parameters
127
     *
128
     * @param \ReflectionMethod $reflect
129
     * @param string            $path
130
     * @param mixed             $data
131
     *
132
     * @return array
133
     */
134
    private function getMethodArgs($reflect, $path, $data)
135
    {
136
        $args = array();
137
        foreach ($reflect->getParameters() as $parameter) {
138
            $name = $parameter->getName();
139
140
            if ($name == 'path') {
141
                $args[] = $path;
142
                continue;
143
            }
144
145
            if ($name == 'data') {
146
                $args[] = $data;
147
                continue;
148
            }
149
150
            $args[] = S::$n->provider($name, $this->module);
151
        }
152
153
        return $args;
154
    }
155
}
156