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.

tests/unit/ConfigurationInjectionTest.php (5 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
use Robo\Robo;
3
4
use Consolidation\Config\Loader\ConfigProcessor;
5
use Consolidation\Config\Loader\YamlConfigLoader;
6
7
class ConfigurationInjectionTest extends \Codeception\TestCase\Test
8
{
9
    /**
10
     * @var \Robo\Runner
11
     */
12
    private $runner;
13
14
    /**
15
     * @var \CodeGuy
16
     */
17
    protected $guy;
18
19
    public function _before()
20
    {
21
        $this->runner = new \Robo\Runner('\Robo\RoboFileFixture');
22
    }
23
24 View Code Duplication
    public function testNoOptionsNoConfiguration()
25
    {
26
        // Run without any config and without any options
27
        $argv = ['placeholder', 'test:simple-list'];
28
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
29
30
        $this->guy->seeInOutput("a: '1'");
31
        $this->guy->seeInOutput("b: '2'");
32
    }
33
34 View Code Duplication
    public function testOptionsButNoConfiguration()
35
    {
36
        // Set one option, but provide no config
37
        $argv = ['placeholder', 'test:simple-list', '--b=3'];
38
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
39
40
        $this->guy->seeInOutput("a: '1'");
41
        $this->guy->seeInOutput("b: '3'");
42
    }
43
44 View Code Duplication
    public function testWithConfigurationButNoOptions()
45
    {
46
        \Robo\Robo::config()->set('command.test.simple-list.options.a', '4');
47
        \Robo\Robo::config()->set('command.test.simple-list.options.b', '5');
48
49
        $argv = ['placeholder', 'test:simple-list'];
50
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
51
52
        $this->guy->seeInOutput("a: '4'");
53
        $this->guy->seeInOutput("b: '5'");
54
    }
55
56 View Code Duplication
    public function testHelpWithoutConfiguration()
57
    {
58
        $argv = ['placeholder', 'help', 'test:simple-list'];
59
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
60
61
        $this->guy->seeInOutput('[default: "1"]');
62
        $this->guy->seeInOutput('[default: "2"]');
63
    }
64
65 View Code Duplication
    public function testHelpWithConfigurationButNoOptions()
66
    {
67
        \Robo\Robo::config()->set('command.test.simple-list.options.a', '4');
68
        \Robo\Robo::config()->set('command.test.simple-list.options.b', '5');
69
70
        $argv = ['placeholder', 'help', 'test:simple-list'];
71
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
72
73
        $this->guy->seeInOutput('[default: "4"]');
74
        $this->guy->seeInOutput('[default: "5"]');
75
    }
76
77 View Code Duplication
    public function testWithConfigurationAndOptionOverride()
78
    {
79
        \Robo\Robo::config()->set('command.test.simple-list.options.a', '4');
80
        \Robo\Robo::config()->set('command.test.simple-list.options.b', '5');
81
82
        $argv = ['placeholder', 'test:simple-list', '--b=6'];
83
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
84
85
        $this->guy->seeInOutput("a: '4'");
86
        $this->guy->seeInOutput("b: '6'");
87
    }
88
89 View Code Duplication
    public function testWithConfigurationFallbacks()
90
    {
91
        \Robo\Robo::config()->set('command.test.simple-list.options.a', '4');
92
        \Robo\Robo::config()->set('command.test.options.b', '7');
93
94
        $argv = ['placeholder', 'test:simple-list'];
95
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
96
97
        $this->guy->seeInOutput("a: '4'");
98
        $this->guy->seeInOutput("b: '7'");
99
    }
100
101
    public function testSettingConfigurationFromCommandOptions()
102
    {
103
        $argv = ['placeholder', 'test:simple-list', '-D', 'config.key=value'];
104
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
105
106
        $this->guy->seeInOutput("a: '1'");
107
        $this->guy->seeInOutput("b: '2'");
108
109
        $actual = \Robo\Robo::config()->get('config.key');
110
        $this->assertEquals('value', $actual);
111
    }
112
113 View Code Duplication
    public function testWithConfigLoader()
114
    {
115
        $loader = new YamlConfigLoader();
116
        $loader->load(dirname(__DIR__) . '/_data/robo.yml');
117
118
        \Robo\Robo::config()->import($loader->export());
0 ignored issues
show
Deprecated Code introduced by
The method Consolidation\Config\ConfigInterface::import() has been deprecated with message: Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.

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...
119
120
        $argv = ['placeholder', 'test:simple-list'];
121
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
122
123
        $this->guy->seeInOutput("a: '12'");
124
        $this->guy->seeInOutput("b: '13'");
125
    }
126
127 View Code Duplication
    public function testWithConfigLoaderAndCliOverride()
128
    {
129
        $loader = new YamlConfigLoader();
130
        $loader->load(dirname(__DIR__) . '/_data/robo.yml');
131
132
        \Robo\Robo::config()->import($loader->export());
0 ignored issues
show
Deprecated Code introduced by
The method Consolidation\Config\ConfigInterface::import() has been deprecated with message: Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.

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...
133
134
        $argv = ['placeholder', 'test:simple-list', '--b=3'];
135
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
136
137
        $this->guy->seeInOutput("a: '12'");
138
        $this->guy->seeInOutput("b: '3'");
139
    }
140
141
    public function testWithConfigProcessor()
142
    {
143
        $processor = new ConfigProcessor();
144
        $loader = new YamlConfigLoader();
145
        $processor->extend($loader->load(dirname(__DIR__) . '/_data/robo.yml'));
146
        $processor->extend($loader->load(dirname(__DIR__) . '/_data/robo2.yml'));
147
        \Robo\Robo::config()->import($processor->export());
0 ignored issues
show
Deprecated Code introduced by
The method Consolidation\Config\ConfigInterface::import() has been deprecated with message: Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.

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...
148
149
        $argv = ['placeholder', 'test:simple-list'];
150
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
151
152
        $this->guy->seeInOutput("a: '112'");
153
        $this->guy->seeInOutput("b: '13'");
154
    }
155
156 View Code Duplication
    public function testCommandWithTaskConfiguration()
157
    {
158
        $loader = new YamlConfigLoader();
159
        $loader->load(dirname(__DIR__) . '/_data/robo.yml');
160
161
        \Robo\Robo::config()->import($loader->export());
0 ignored issues
show
Deprecated Code introduced by
The method Consolidation\Config\ConfigInterface::import() has been deprecated with message: Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.

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...
162
163
        $argv = ['placeholder', 'test:exec', '--simulate'];
164
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
165
166
        // `task.Base.Exec.settings.dir` is defined in loaded robo.yml configuration file.
167
        $this->guy->seeInOutput("->dir('/some/dir')");
168
    }
169
170 View Code Duplication
    public function testCommandWithFallbackTaskConfiguration()
171
    {
172
        $loader = new YamlConfigLoader();
173
        $loader->load(dirname(__DIR__) . '/_data/falback-task-config-robo.yml');
174
175
        \Robo\Robo::config()->import($loader->export());
0 ignored issues
show
Deprecated Code introduced by
The method Consolidation\Config\ConfigInterface::import() has been deprecated with message: Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.

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...
176
177
        $argv = ['placeholder', 'test:exec', '--simulate'];
178
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
179
180
        // `task.Base.settings.dir` is defined in loaded robo.yml configuration file.
181
        $this->guy->seeInOutput("->dir('/some/other/dir')");
182
    }
183
}
184