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/Workflow/ClearCodeCaches.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
 * See class comment
4
 *
5
 * PHP Version 5
6
 *
7
 * @category Netresearch
8
 * @package  Netresearch\Kite\Workflow
9
 * @author   Christian Opitz <[email protected]>
10
 * @license  http://www.netresearch.de Netresearch Copyright
11
 * @link     http://www.netresearch.de
12
 */
13
14
namespace Netresearch\Kite\Workflow;
15
use Netresearch\Kite\Workflow;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * Clears code caches not available from shell and calls (statcache, opcache and apc).
20
 *
21
 * Creates a PHP script on the nodes or locally and calls it via the webUrl or node.webUrl
22
 *
23
 * @category Netresearch
24
 * @package  Netresearch\Kite\Workflow
25
 * @author   Christian Opitz <[email protected]>
26
 * @license  http://www.netresearch.de Netresearch Copyright
27
 * @link     http://www.netresearch.de
28
 */
29
class ClearCodeCaches extends Workflow
30
{
31
    /**
32
     * Variable configuration
33
     *
34
     * @return array
35
     */
36
    protected function configureVariables()
37
    {
38
        return array(
39
            'webUrl' => array(
40
                'type' => 'string',
41
                'label' => 'URL to the current web root. Set this if you want to clear caches locally - otherwise this WF will clear the node(s) caches'
42
            ),
43
            'baseDir' => array(
44
                'type' => 'string',
45
                'default' => '{config["workspace"]}',
46
                'label' => 'Path relative to current application root and webUrl, where the temp script will be stored'
47
            )
48
        ) + parent::configureVariables();
49
    }
50
51
52
    /**
53
     * Override to assemble the tasks
54
     *
55
     * @return void
56
     */
57
    public function assemble()
58
    {
59
        $this->callback(
60
            function () {
61
                $scriptPath = $this->createScript();
62
                if ($webUrl = $this->get('webUrl')) {
63
                    $this->callScript($webUrl, $scriptPath);
64
                } else {
65
                    $this->scp($scriptPath, '{node}:{node.webRoot}/' . $scriptPath);
66
                    foreach ($this->get('nodes') as $node) {
67
                        /* @var \Netresearch\Kite\Node $node */
68
                        if ($webUrl = $node->get('webUrl', null)) {
69
                            $this->callScript($webUrl, $scriptPath);
70
                        } else {
71
                            $this->console->output("<warning>Node $node ({$node->get('id')}) has no webUrl set</warning>");
72
                        }
73
                    }
74
                }
75
            }
76
        );
77
    }
78
79
    /**
80
     * Create the script
81
     *
82
     * @return string The relative script path
83
     */
84
    protected function createScript()
85
    {
86
        $scriptPath = $this->get('baseDir') . '/ccc-' . uniqid() . '.php';
87
        file_put_contents(
88
            $scriptPath,
89
            '<?' . "php
90
            if (function_exists('clearstatcache')) {
91
                echo 'statcache|';
92
                clearstatcache(true);
93
            }
94
            if (function_exists('opcache_reset')) {
95
                echo 'opcache|';
96
                opcache_reset();
97
            }
98
            if (function_exists('apc_clear_cache')) {
99
                echo 'apc|';
100
                apc_clear_cache();
101
            }
102
            if (function_exists('xcache_clear_cache')) {
103
                echo 'xcache|';
104
                xcache_clear_cache(XC_TYPE_PHP);
105
            }
106
            unlink(__FILE__);
107
            echo 'SUCCESS';
108
            ?>\n"
109
        );
110
        return $scriptPath;
111
    }
112
113
    /**
114
     * Call the script via web URL
115
     *
116
     * @param string $baseUrl    URL to web root
117
     * @param string $scriptPath Path to script (relative to baseUrl)
118
     *
119
     * @return void
120
     */
121
    protected function callScript($baseUrl, $scriptPath)
122
    {
123
        $url = rtrim($baseUrl, '/') . '/' . ltrim($scriptPath, '/');
124
125
        $this->console->output('Calling ' . $url, OutputInterface::VERBOSITY_DEBUG);
126
        $ch = curl_init();
127
        curl_setopt($ch, CURLOPT_URL, $url);
128
        curl_setopt($ch, CURLOPT_HEADER, 1);
129
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
130
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
131
        $response = curl_exec($ch);
132
        $content = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
133
134
        $caches = explode('|', $content);
135
        if (array_pop($caches) !== 'SUCCESS') {
136
            $this->console->output("<error>Clearcache not run successfully</error>");
137
            $this->console->indent();
138
            if ($response === false) {
139
                $msg = curl_error($ch);
140
            } else {
141
                $msg = $response;
142
            }
143
            $this->console->output($msg, OutputInterface::VERBOSITY_DEBUG);
144
            $this->console->outdent();
145
        } else {
146
            if ($caches) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $caches of type array 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...
147
                $this->console->output('Cleared code caches (' . implode(', ', $caches) . ')');
148
            } else {
149
                $this->console->output('No code caches found');
150
            }
151
        }
152
    }
153
}
154
155
?>
156