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/Testing/Codecept.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\Testing;
4
5
use Robo\Contract\PrintedInterface;
6
use Robo\Exception\TaskException;
7
use Robo\Task\BaseTask;
8
use Robo\Contract\CommandInterface;
9
use Symfony\Component\Process\Process;
10
11
/**
12
 * Executes Codeception tests
13
 *
14
 * ``` php
15
 * <?php
16
 * // config
17
 * $this->taskCodecept()
18
 *      ->suite('acceptance')
19
 *      ->env('chrome')
20
 *      ->group('admin')
21
 *      ->xml()
22
 *      ->html()
23
 *      ->run();
24
 *
25
 * ?>
26
 * ```
27
 *
28
 */
29
class Codecept extends BaseTask implements CommandInterface, PrintedInterface
30
{
31
    use \Robo\Common\ExecOneCommand;
32
33
    /**
34
     * @var string
35
     */
36
    protected $command;
37
    protected $providedPathToCodeception;
38
39
    /**
40
     * @param string $pathToCodeception
41
     *
42
     * @throws \Robo\Exception\TaskException
43
     */
44
    public function __construct($pathToCodeception = '')
45
    {
46
        $this->providedPathToCodeception = $pathToCodeception;
47
    }
48
49
    /**
50
     * @param string $suite
51
     *
52
     * @return $this
53
     */
54
    public function suite($suite)
55
    {
56
        $this->option(null, $suite);
57
        return $this;
58
    }
59
60
    /**
61
     * @param string $testName
62
     *
63
     * @return $this
64
     */
65
    public function test($testName)
66
    {
67
        $this->option(null, $testName);
68
        return $this;
69
    }
70
71
    /**
72
     * set group option. Can be called multiple times
73
     *
74
     * @param string $group
75
     *
76
     * @return $this
77
     */
78
    public function group($group)
79
    {
80
        $this->option("group", $group);
81
        return $this;
82
    }
83
84
    /**
85
     * @param string $group
86
     *
87
     * @return $this
88
     */
89
    public function excludeGroup($group)
90
    {
91
        $this->option("skip-group", $group);
92
        return $this;
93
    }
94
95
    /**
96
     * generate json report
97
     *
98
     * @param string $file
99
     *
100
     * @return $this
101
     */
102
    public function json($file = null)
103
    {
104
        $this->option("json", $file);
105
        return $this;
106
    }
107
108
    /**
109
     * generate xml JUnit report
110
     *
111
     * @param string $file
112
     *
113
     * @return $this
114
     */
115
    public function xml($file = null)
116
    {
117
        $this->option("xml", $file);
118
        return $this;
119
    }
120
121
    /**
122
     * Generate html report
123
     *
124
     * @param string $dir
125
     *
126
     * @return $this
127
     */
128
    public function html($dir = null)
129
    {
130
        $this->option("html", $dir);
131
        return $this;
132
    }
133
134
    /**
135
     * generate tap report
136
     *
137
     * @param string $file
138
     *
139
     * @return $this
140
     */
141
    public function tap($file = null)
142
    {
143
        $this->option("tap", $file);
144
        return $this;
145
    }
146
147
    /**
148
     * provides config file other then default `codeception.yml` with `-c` option
149
     *
150
     * @param string $file
151
     *
152
     * @return $this
153
     */
154
    public function configFile($file)
155
    {
156
        $this->option("-c", $file);
157
        return $this;
158
    }
159
160
    /**
161
     * collect codecoverage in raw format. You may pass name of cov file to save results
162
     *
163
     * @param null|string $cov
164
     *
165
     * @return $this
166
     */
167
    public function coverage($cov = null)
168
    {
169
        $this->option("coverage", $cov);
170
        return $this;
171
    }
172
173
    /**
174
     * execute in silent mode
175
     *
176
     * @return $this
177
     */
178
    public function silent()
179
    {
180
        $this->option("silent");
181
        return $this;
182
    }
183
184
    /**
185
     * collect code coverage in xml format. You may pass name of xml file to save results
186
     *
187
     * @param string $xml
188
     *
189
     * @return $this
190
     */
191
    public function coverageXml($xml = null)
192
    {
193
        $this->option("coverage-xml", $xml);
194
        return $this;
195
    }
196
197
    /**
198
     * collect code coverage and generate html report. You may pass
199
     *
200
     * @param string $html
201
     *
202
     * @return $this
203
     */
204
    public function coverageHtml($html = null)
205
    {
206
        $this->option("coverage-html", $html);
207
        return $this;
208
    }
209
210
    /**
211
     * @param string $env
212
     *
213
     * @return $this
214
     */
215
    public function env($env)
216
    {
217
        $this->option("env", $env);
218
        return $this;
219
    }
220
221
    /**
222
     * @return $this
223
     */
224
    public function debug()
225
    {
226
        $this->option("debug");
227
        return $this;
228
    }
229
230
    /**
231
     * @return $this
232
     */
233
    public function noRebuild()
234
    {
235
        $this->option("no-rebuild");
236
        return $this;
237
    }
238
239
    /**
240
     * @param string $failGroup
241
     * @return $this
242
     */
243
    public function failGroup($failGroup)
244
    {
245
        $this->option('override', "extensions: config: Codeception\\Extension\\RunFailed: fail-group: {$failGroup}");
246
        return $this;
247
    }
248
249
    /**
250
     * {@inheritdoc}
251
     */
252
    public function getCommand()
253
    {
254
        if (!$this->command) {
255
            $this->command = $this->providedPathToCodeception;
256
            if (!$this->command) {
257
                $this->command = $this->findExecutable('codecept');
258
            }
259
            if (!$this->command) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->command of type string|false is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
260
                debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
261
                throw new TaskException(__CLASS__, "Neither composer nor phar installation of Codeception found.");
262
            }
263
            $this->command .= ' run';
264
        }
265
266
        return $this->command . $this->arguments;
267
    }
268
269
    /**
270
     * {@inheritdoc}
271
     */
272
    public function run()
273
    {
274
        $command = $this->getCommand();
275
        $this->printTaskInfo('Executing {command}', ['command' => $command]);
276
        return $this->executeCommand($command);
277
    }
278
}
279