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/HgStack.php (3 issues)

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
7
/**
8
 * Runs hg commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
9
 *
10
 * ``` php
11
 * <?php
12
 * $this->hgStack
13
 *  ->cloneRepo('https://bitbucket.org/durin42/hgsubversion')
14
 *  ->pull()
15
 *  ->add()
16
 *  ->commit('changed')
17
 *  ->push()
18
 *  ->tag('0.6.0')
19
 *  ->push('0.6.0')
20
 *  ->run();
21
 * ?>
22
 * ```
23
 */
24
class HgStack extends CommandStack
25
{
26
27
    /**
28
     * @param string $pathToHg
29
     */
30
    public function __construct($pathToHg = 'hg')
31
    {
32
        $this->executable = $pathToHg;
33
    }
34
35
    /**
36
     * Executes `hg clone`
37
     *
38
     * @param string $repo
39
     * @param string $to
40
     *
41
     * @return $this
42
     */
43
    public function cloneRepo($repo, $to = '')
44
    {
45
        return $this->exec(['clone', $repo, $to]);
46
    }
47
48
    /**
49
     * Executes `hg add` command with files to add by pattern
50
     *
51
     * @param string $include
52
     * @param string $exclude
53
     *
54
     * @return $this
55
     */
56
    public function add($include = '', $exclude = '')
57
    {
58
        if (strlen($include) > 0) {
59
            $include = "-I {$include}";
60
        }
61
62
        if (strlen($exclude) > 0) {
63
            $exclude = "-X {$exclude}";
64
        }
65
66
        return $this->exec([__FUNCTION__, $include, $exclude]);
67
    }
68
69
    /**
70
     * Executes `hg commit` command with a message
71
     *
72
     * @param string $message
73
     * @param string $options
74
     *
75
     * @return $this
76
     */
77
    public function commit($message, $options = '')
78
    {
79
        return $this->exec([__FUNCTION__, "-m '{$message}'", $options]);
80
    }
81
82
    /**
83
     * Executes `hg pull` command.
84
     *
85
     * @param string $branch
86
     *
87
     * @return $this
88
     */
89 View Code Duplication
    public function pull($branch = '')
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...
90
    {
91
        if (strlen($branch) > 0) {
92
            $branch = "-b '{$branch}''";
93
        }
94
95
        return $this->exec([__FUNCTION__, $branch]);
96
    }
97
98
    /**
99
     * Executes `hg push` command
100
     *
101
     * @param string $branch
102
     *
103
     * @return $this
104
     */
105 View Code Duplication
    public function push($branch = '')
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...
106
    {
107
        if (strlen($branch) > 0) {
108
            $branch = "-b '{$branch}'";
109
        }
110
111
        return $this->exec([__FUNCTION__, $branch]);
112
    }
113
114
    /**
115
     * Performs hg merge
116
     *
117
     * @param string $revision
118
     *
119
     * @return $this
120
     */
121
    public function merge($revision = '')
122
    {
123
        if (strlen($revision) > 0) {
124
            $revision = "-r {$revision}";
125
        }
126
127
        return $this->exec([__FUNCTION__, $revision]);
128
    }
129
130
    /**
131
     * Executes `hg tag` command
132
     *
133
     * @param string $tag_name
134
     * @param string $message
135
     *
136
     * @return $this
137
     */
138 View Code Duplication
    public function tag($tag_name, $message = '')
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...
139
    {
140
        if ($message !== '') {
141
            $message = "-m '{$message}'";
142
        }
143
        return $this->exec([__FUNCTION__, $message, $tag_name]);
144
    }
145
146
    /**
147
     * {@inheritdoc}
148
     */
149
    public function run()
150
    {
151
        $this->printTaskInfo('Running hg commands...');
152
        return parent::run();
153
    }
154
}
155