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

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/Task/RemoteShellTask.php (3 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
 * See class comment
4
 *
5
 * PHP Version 5
6
 *
7
 * @category   Netresearch
8
 * @package    Netresearch\Kite
9
 * @subpackage Task
10
 * @author     Christian Opitz <[email protected]>
11
 * @license    http://www.netresearch.de Netresearch Copyright
12
 * @link       http://www.netresearch.de
13
 */
14
15
namespace Netresearch\Kite\Task;
16
use Netresearch\Kite\Node;
17
18
/**
19
 * Execute a shell command on either the current node or all nodes
20
 *
21
 * @category   Netresearch
22
 * @package    Netresearch\Kite
23
 * @subpackage Task
24
 * @author     Christian Opitz <[email protected]>
25
 * @license    http://www.netresearch.de Netresearch Copyright
26
 * @link       http://www.netresearch.de
27
 */
28
class RemoteShellTask extends ShellTask
29
{
30
    /**
31
     * @var string
32
     */
33
    protected $cwd;
34
35
    /**
36
     * Hide the cwd from ShellTask
37
     *
38
     * @param string $option Option
39
     * @param mixed  $value  Value
40
     *
41
     * @return void
42
     */
43
    public function offsetSet($option, $value)
44
    {
45
        if ($option === 'cwd') {
46
            $this->cwd = $value;
47
            return;
48
        }
49
        parent::offsetSet($option, $value);
50
    }
51
52
    /**
53
     * Execute the task for each of the available nodes or the current node if set
54
     *
55
     * @return array|mixed Return value(s) of the command on the node(s)
56
     */
57
    public function execute()
58
    {
59
        if ($this->has('node')) {
60
            return $this->executeCommand();
61
        }
62
63
        /* @var \Netresearch\Kite\Node[] $nodes */
64
        $nodes = $this->get('nodes');
65
        if (!$nodes) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $nodes of type Netresearch\Kite\Node[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
66
            throw new \Netresearch\Kite\Exception('No nodes to work on');
67
        }
68
        $returnValues = array();
69
        foreach ($nodes as $node) {
70
            $this->set('node', $node);
71
            try {
72
                $returnValues[$node->get('id')] = $this->executeCommand();
73
            } catch (\Exception $e) {
74
                $this->remove('node');
75
                throw $e;
76
            }
77
        }
78
        $this->remove('node');
79
        return $returnValues;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $returnValues; (array) is incompatible with the return type of the parent method Netresearch\Kite\Task\ShellTask::execute of type null|string.

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...
80
    }
81
82
    /**
83
     * Get the command to execute
84
     *
85
     * @return string
86
     */
87
    protected function getCommand()
88
    {
89
        return $this->getSshCommand(
90
            parent::getCommand(),
91
            $this->get('node'), $this->expand($this->cwd)
92
        );
93
    }
94
95
    /**
96
     * Wrap the command in a ssh command
97
     *
98
     * @param string $command The command
99
     * @param Node   $node    The node
100
     * @param string $cwd     The dir to change into (on the node)
101
     *
102
     * @return string
103
     */
104
    protected function getSshCommand($command, Node $node, $cwd = null)
105
    {
106
        if ($cwd && !preg_match('#^cd\s+[\'"]?/#', $command)) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $cwd of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
107
            $command = 'cd ' . escapeshellarg($cwd) . '; ' . $command;
108
        }
109
110
        $sshCommand
111
            = rtrim('ssh' . $node->get('sshOptions'))
112
            . ' ' . escapeshellarg($node->get('url'))
113
            . ' ' . escapeshellarg($command);
114
115
        $this->addExpect($sshCommand, $node);
116
117
        return $sshCommand;
118
    }
119
120
    /**
121
     * Wrap the command in an expect command
122
     *
123
     * @param string $sshCommand The command
124
     * @param Node   $node       The node
125
     *
126
     * @return void
127
     */
128
    protected function addExpect(&$sshCommand, Node $node)
129
    {
130
        $pass = $node->get('pass');
131
        if ($pass) {
132
            $expectFile = dirname(dirname(__DIR__));
133
            $expectFile .= '/res/script/password.expect';
134
            $sshCommand = sprintf('expect %s %s %s', escapeshellarg($expectFile), escapeshellarg($pass), $sshCommand);
135
        }
136
    }
137
}
138
?>
139