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

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/Plugins/Uptime.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
declare(strict_types=1);
3
4
/*
5
 * This file is part of PhuninNode.
6
 *
7
 ** (c) 2013 - 2016 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\PhuninNode\Plugins;
14
15
use React\Promise\PromiseInterface;
16
use WyriHaximus\PhuninNode\Configuration;
17
use WyriHaximus\PhuninNode\Metric;
18
use WyriHaximus\PhuninNode\Node;
19
use WyriHaximus\PhuninNode\PluginInterface;
20
use function React\Promise\resolve;
21
use function WyriHaximus\PhuninNode\metricPromisesToObjectStorage;
22
23
/**
24
 * Class Uptime
25
 * @package WyriHaximus\PhuninNode\Plugins
26
 */
27
class Uptime implements PluginInterface
28
{
29
    /**
30
     * Seconds in a day
31
     */
32
    const DAY_IN_SECONDS = 86400;
33
34
    /**
35
     * @var Node
36
     */
37
    private $node;
38
39
    /**
40
     * Cached configuration state
41
     *
42
     * @var Configuration
43
     */
44
    private $configuration;
45
46
    /**
47
     * Start time of this instance
48
     *
49
     * @var int
50
     */
51
    private $startTime = 0;
52
53
    /**
54
     * Save the time this instance started
55
     */
56 8
    public function __construct()
57
    {
58 8
        $this->startTime = time();
59 8
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64 8
    public function setNode(Node $node)
65
    {
66 8
        $this->node = $node;
67 8
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72 1
    public function getSlug(): string
73
    {
74 1
        return 'uptime';
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80 1
    public function getCategorySlug(): string
81
    {
82 1
        return 'phunin_node';
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 2 View Code Duplication
    public function getConfiguration(): PromiseInterface
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90 2
        if ($this->configuration instanceof Configuration) {
91 1
            return resolve($this->configuration);
92
        }
93
94 2
        $this->configuration = new Configuration();
95 2
        $this->configuration->setPair('graph_category', 'phunin_node');
96 2
        $this->configuration->setPair('graph_title', 'Uptime');
97 2
        $this->configuration->setPair('graph_args', '--base 1000 -l 0');
98 2
        $this->configuration->setPair('graph_vlabel', 'uptime in days');
99 2
        $this->configuration->setPair('uptime.label', 'uptime');
100 2
        $this->configuration->setPair('uptime.draw', 'AREA');
101
102 2
        return resolve($this->configuration);
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108 2
    public function getValues(): PromiseInterface
109
    {
110 2
        return metricPromisesToObjectStorage([
111 2
            $this->getUptimeValue(),
112
        ]);
113
    }
114
115
    /**
116
     * @return Metric
117
     */
118 2
    private function getUptimeValue(): Metric
119
    {
120 2
        $value = new Metric(
121 2
            'uptime',
122 2
            ((time() - $this->startTime) / self::DAY_IN_SECONDS)
123
        );
124 2
        return $value;
125
    }
126
127
    /**
128
     * {@inheritdoc}
129
     */
130 1
    public function getCapabilities(): array
131
    {
132 1
        return [];
133
    }
134
}
135