Issues (8)

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/Output/Projects.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 Rs\VersionEye\Output;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
/**
8
 * Projects.
9
 *
10
 * @author Robert Schönthal <[email protected]>
11
 */
12
class Projects extends BaseOutput
13
{
14
    /**
15
     * output for projects API.
16
     *
17
     * @param OutputInterface $output
18
     * @param array           $response
19
     */
20 1
    public function all(OutputInterface $output, array $response)
21
    {
22 1
        $this->printTable($output,
23 1
            ['Key', 'Name', 'Type', 'Public', 'Dependencies', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
24 1
            ['ids', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_at', 'licenses_red', 'licenses_unknown'],
25
            $response,
26
            function ($key, $value) use ($output) {
27 1
                if ('public' === $key) {
28 1
                    return $value === 1 ? 'Yes' : 'No';
29
                }
30
31 1
                if (!in_array($key, ['out_number', 'licenses_red', 'licenses_unknown'], true)) {
32 1
                    return $value;
33
                }
34
35 1
                return $this->printBoolean($output, $value > 0 ? $value : 'No', $value, !$value, false);
36 1
            }
37
        );
38 1
    }
39
40
    /**
41
     * output for licenses API.
42
     *
43
     * @param OutputInterface $output
44
     * @param array           $response
45
     */
46 1
    public function licenses(OutputInterface $output, array $response)
47
    {
48 1
        $table = $this->createTable($output);
49 1
        $table->setHeaders(['license', 'name']);
50
51 1
        foreach ($response['licenses'] as $license => $projects) {
52 1
            foreach ($projects as $project) {
53 1
                $name    = $license === 'unknown' ? '<error>' . $project['name'] . '</error>' : $project['name'];
54 1
                $license = $license === 'unknown' ? '<error>unknown</error>' : $license;
55
56 1
                $table->addRow([$license, $name]);
57
            }
58
        }
59
60 1
        $table->render($output);
0 ignored issues
show
The call to Table::render() has too many arguments starting with $output.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
61 1
    }
62
63
    /**
64
     * output for show API.
65
     *
66
     * @param OutputInterface $output
67
     * @param array           $response
68
     */
69 1
    public function show(OutputInterface $output, array $response)
70
    {
71 1
        $this->output($output, $response);
72 1
    }
73
74
    /**
75
     * output for update API.
76
     *
77
     * @param OutputInterface $output
78
     * @param array           $response
79
     */
80 1
    public function update(OutputInterface $output, array $response)
81
    {
82 1
        $this->output($output, $response);
83 1
    }
84
85
    /**
86
     * output for create API.
87
     *
88
     * @param OutputInterface $output
89
     * @param array           $response
90
     */
91 1
    public function create(OutputInterface $output, array $response)
92
    {
93 1
        $this->output($output, $response);
94 1
    }
95
96
    /**
97
     * output for delete API.
98
     *
99
     * @param OutputInterface $output
100
     * @param array           $response
101
     */
102 1
    public function delete(OutputInterface $output, array $response)
103
    {
104 1
        $this->printMessage($output, $response);
105 1
    }
106
107
    /**
108
     * default output for create/show/update.
109
     *
110
     * @param OutputInterface $output
111
     * @param array           $response
112
     */
113 3
    private function output(OutputInterface $output, array $response)
114
    {
115 3
        $this->printList($output,
116 3
            ['Name', 'Key', 'Type', 'Public', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
117 3
            ['name', 'id', 'project_type', 'public', 'out_number', 'updated_at', 'licenses_red', 'licenses_unknown'],
118
            $response,
119
            function ($key, $value) use ($output) {
120 3
                if (in_array($key, ['Outdated', 'Bad Licenses', 'Unknown Licenses'], true)) {
121 3
                    return $this->printBoolean($output, $value === 0 ? 'No' : $value, $value, !$value, false);
122
                }
123
124 3
                return $value;
125 3
            }
126
        );
127
128 3
        $this->printTable($output,
129 3
            ['Name', 'Stable', 'Outdated', 'Current', 'Requested', 'Licenses', 'Vulnerabilities'],
130 3
            ['name', 'stable', 'outdated', 'version_current', 'version_requested', 'licenses', 'security_vulnerabilities'],
131 3
            $response['dependencies'],
132 3
            function ($key, $value) use ($output) {
133 3
                if ('licenses' === $key) {
134 3
                    return implode(', ', array_column($value, 'name'));
135
                }
136 3
                if ('stable' === $key) {
137 3
                    return $this->printBoolean($output, 'Yes', 'No', $value, false);
138
                }
139 3
                if ('outdated' === $key) {
140 3
                    return $this->printBoolean($output, 'No', 'Yes', !$value, false);
141
                }
142
143 3
                if ('security_vulnerabilities' === $key) {
144 3
                    if (is_array($value)) {
145 3
                        return $this->printBoolean($output, 'No', implode(', ', array_column($value, 'cve')), count($value) === 0, false);
146
                    }
147
148
                    return $this->printBoolean($output, 'No', 'Yes', true, false);
149
                }
150
151 3
                return $value;
152 3
            }
153
        );
154 3
    }
155
156
    /**
157
     * output for the merge API.
158
     *
159
     * @param OutputInterface $output
160
     * @param array           $response
161
     */
162 1
    public function merge(OutputInterface $output, array $response)
163
    {
164 1
        $this->printBoolean($output, 'OK', 'FAIL', true === $response['success']);
165 1
    }
166
167
    /**
168
     * output for the merge_ga API.
169
     *
170
     * @param OutputInterface $output
171
     * @param array           $response
172
     */
173 1
    public function mergeGa(OutputInterface $output, array $response)
174
    {
175 1
        $this->printBoolean($output, 'OK', 'FAIL', true === $response['success']);
176 1
    }
177
178
    /**
179
     * output for the unmerge API.
180
     *
181
     * @param OutputInterface $output
182
     * @param array           $response
183
     */
184 1
    public function unmerge(OutputInterface $output, array $response)
185
    {
186 1
        $this->printBoolean($output, 'OK', 'FAIL', true === $response['success']);
187 1
    }
188
}
189