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/Vcs/GitStack.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\Vcs;
4
5
use Robo\Task\CommandStack;
6
use Robo\Common\ProcessUtils;
7
8
/**
9
 * Runs Git commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
10
 *
11
 * ``` php
12
 * <?php
13
 * $this->taskGitStack()
14
 *  ->stopOnFail()
15
 *  ->add('-A')
16
 *  ->commit('adding everything')
17
 *  ->push('origin','master')
18
 *  ->tag('0.6.0')
19
 *  ->push('origin','0.6.0')
20
 *  ->run()
21
 *
22
 * $this->taskGitStack()
23
 *  ->stopOnFail()
24
 *  ->add('doc/*')
25
 *  ->commit('doc updated')
26
 *  ->push()
27
 *  ->run();
28
 * ?>
29
 * ```
30
 */
31
class GitStack extends CommandStack
32
{
33
    /**
34
     * @param string $pathToGit
35
     */
36
    public function __construct($pathToGit = 'git')
37
    {
38
        $this->executable = $pathToGit;
39
    }
40
41
    /**
42
     * Executes `git clone`
43
     *
44
     * @param string $repo
45
     * @param string $to
46
     * @param string $branch
47
     *
48
     * @return $this
49
     */
50 View Code Duplication
    public function cloneRepo($repo, $to = "", $branch = "")
51
    {
52
        $cmd = ['clone', $repo, $to];
53
        if (!empty($branch)) {
54
            $cmd[] = "--branch $branch";
55
        }
56
        return $this->exec($cmd);
57
    }
58
59
    /**
60
     * Executes `git clone` with depth 1 as default
61
     *
62
     * @param string $repo
63
     * @param string $to
64
     * @param string $branch
65
     * @param int    $depth
66
     *
67
     * @return $this
68
     */
69 View Code Duplication
    public function cloneShallow($repo, $to = '', $branch = "", $depth = 1)
70
    {
71
        $cmd = ["clone --depth $depth", $repo, $to];
72
        if (!empty($branch)) {
73
            $cmd[] = "--branch $branch";
74
        }
75
76
        return $this->exec($cmd);
77
    }
78
79
    /**
80
     * Executes `git add` command with files to add pattern
81
     *
82
     * @param string $pattern
83
     *
84
     * @return $this
85
     */
86
    public function add($pattern)
87
    {
88
        return $this->exec([__FUNCTION__, $pattern]);
89
    }
90
91
    /**
92
     * Executes `git commit` command with a message
93
     *
94
     * @param string $message
95
     * @param string $options
96
     *
97
     * @return $this
98
     */
99
    public function commit($message, $options = "")
100
    {
101
        $message = ProcessUtils::escapeArgument($message);
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\ProcessUtils::escapeArgument() has been deprecated with message: since version 3.3, to be removed in 4.0. Use a command line array or give env vars to the `Process::start/run()` method instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
102
        return $this->exec([__FUNCTION__, "-m $message", $options]);
103
    }
104
105
    /**
106
     * Executes `git pull` command.
107
     *
108
     * @param string $origin
109
     * @param string $branch
110
     *
111
     * @return $this
112
     */
113
    public function pull($origin = '', $branch = '')
114
    {
115
        return $this->exec([__FUNCTION__, $origin, $branch]);
116
    }
117
118
    /**
119
     * Executes `git push` command
120
     *
121
     * @param string $origin
122
     * @param string $branch
123
     *
124
     * @return $this
125
     */
126
    public function push($origin = '', $branch = '')
127
    {
128
        return $this->exec([__FUNCTION__, $origin, $branch]);
129
    }
130
131
    /**
132
     * Performs git merge
133
     *
134
     * @param string $branch
135
     *
136
     * @return $this
137
     */
138
    public function merge($branch)
139
    {
140
        return $this->exec([__FUNCTION__, $branch]);
141
    }
142
143
    /**
144
     * Executes `git checkout` command
145
     *
146
     * @param string $branch
147
     *
148
     * @return $this
149
     */
150
    public function checkout($branch)
151
    {
152
        return $this->exec([__FUNCTION__, $branch]);
153
    }
154
155
    /**
156
     * Executes `git tag` command
157
     *
158
     * @param string $tag_name
159
     * @param string $message
160
     *
161
     * @return $this
162
     */
163 View Code Duplication
    public function tag($tag_name, $message = "")
164
    {
165
        if ($message != "") {
166
            $message = "-m '$message'";
167
        }
168
        return $this->exec([__FUNCTION__, $message, $tag_name]);
169
    }
170
171
    /**
172
     * {@inheritdoc}
173
     */
174
    public function run()
175
    {
176
        $this->printTaskInfo("Running git commands...");
177
        return parent::run();
178
    }
179
}
180