Issues (569)

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/Task/Development/GitHubRelease.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 Robo\Task\Development;
4
5
use Robo\Result;
6
7
/**
8
 * Publishes new GitHub release.
9
 *
10
 * ``` php
11
 * <?php
12
 * $this->taskGitHubRelease('0.1.0')
13
 *   ->uri('consolidation-org/Robo')
14
 *   ->description('Add stuff people need.')
15
 *   ->change('Fix #123')
16
 *   ->change('Add frobulation method to all widgets')
17
 *   ->run();
18
 * ?>
19
 * ```
20
 */
21
class GitHubRelease extends GitHub
22
{
23
    /**
24
     * @var string
25
     */
26
    protected $tag;
27
28
    /**
29
     * @var string
30
     */
31
    protected $name;
32
33
    /**
34
     * @var string
35
     */
36
    protected $description = '';
37
38
    /**
39
     * @var string[]
40
     */
41
    protected $changes = [];
42
43
    /**
44
     * @var bool
45
     */
46
    protected $draft = false;
47
48
    /**
49
     * @var bool
50
     */
51
    protected $prerelease = false;
52
53
    /**
54
     * @var string
55
     */
56
    protected $comittish = 'master';
57
58
    /**
59
     * @param string $tag
60
     */
61
    public function __construct($tag)
62
    {
63
        $this->tag = $tag;
64
    }
65
66
    /**
67
     * @param string $tag
68
     *
69
     * @return $this
70
     */
71
    public function tag($tag)
72
    {
73
        $this->tag = $tag;
74
        return $this;
75
    }
76
77
    /**
78
     * @param bool $draft
79
     *
80
     * @return $this
81
     */
82
    public function draft($draft)
83
    {
84
        $this->draft = $draft;
85
        return $this;
86
    }
87
88
    /**
89
     * @param string $name
90
     *
91
     * @return $this
92
     */
93
    public function name($name)
94
    {
95
        $this->name = $name;
96
        return $this;
97
    }
98
99
    /**
100
     * @param string $description
101
     *
102
     * @return $this
103
     */
104
    public function description($description)
105
    {
106
        $this->description = $description;
107
        return $this;
108
    }
109
110
    /**
111
     * @param bool $prerelease
112
     *
113
     * @return $this
114
     */
115
    public function prerelease($prerelease)
116
    {
117
        $this->prerelease = $prerelease;
118
        return $this;
119
    }
120
121
    /**
122
     * @param string $comittish
123
     *
124
     * @return $this
125
     */
126
    public function comittish($comittish)
127
    {
128
        $this->comittish = $comittish;
129
        return $this;
130
    }
131
132
    /**
133
     * @param string $description
134
     *
135
     * @return $this
136
     */
137
    public function appendDescription($description)
138
    {
139
        if (!empty($this->description)) {
140
            $this->description .= "\n\n";
141
        }
142
        $this->description .= $description;
143
        return $this;
144
    }
145
146
    public function changes(array $changes)
147
    {
148
        $this->changes = array_merge($this->changes, $changes);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_merge($this->changes, $changes) of type array is incompatible with the declared type array<integer,string> of property $changes.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
149
        return $this;
150
    }
151
152
    /**
153
     * @param string $change
154
     *
155
     * @return $this
156
     */
157
    public function change($change)
158
    {
159
        $this->changes[] = $change;
160
        return $this;
161
    }
162
163
    /**
164
     * @return string
165
     */
166
    protected function getBody()
167
    {
168
        $body = $this->description;
169
        if (!empty($this->changes)) {
170
            $changes = array_map(
171
                function ($line) {
172
                    return "* $line";
173
                },
174
                $this->changes
175
            );
176
            $changesText = implode("\n", $changes);
177
            $body .= "### Changelog \n\n$changesText";
178
        }
179
        return $body;
180
    }
181
182
    /**
183
     * {@inheritdoc}
184
     */
185
    public function run()
186
    {
187
        $this->printTaskInfo('Releasing {tag}', ['tag' => $this->tag]);
188
        $this->startTimer();
189
        list($code, $data) = $this->sendRequest(
190
            'releases',
191
            [
192
                "tag_name" => $this->tag,
193
                "target_commitish" => $this->comittish,
194
                "name" => $this->name,
195
                "body" => $this->getBody(),
196
                "draft" => $this->draft,
197
                "prerelease" => $this->prerelease
198
            ]
199
        );
200
        $this->stopTimer();
201
202
        return new Result(
203
            $this,
204
            in_array($code, [200, 201]) ? 0 : 1,
205
            isset($data->message) ? $data->message : '',
206
            ['response' => $data, 'time' => $this->getExecutionTime()]
207
        );
208
    }
209
}
210