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/ApplicationTest.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
require_once codecept_data_dir() . 'TestedRoboFile.php';
3
4
use Robo\Robo;
5
use Consolidation\AnnotatedCommand\Parser\CommandInfo;
6
use Robo\Collection\CollectionBuilder;
7
8
class ApplicationTest extends \Codeception\TestCase\Test
9
{
10
    /**
11
     * @var \Robo\Runner
12
     */
13
    private $runner;
14
15
    /**
16
     * @var \Robo\Application
17
     */
18
    private $app;
19
20
    /**
21
     * @var Consolidation\AnnotatedCommand\AnnotatedCommandFactory
22
     */
23
    private $commandFactory;
24
25
    /**
26
     * @var TestRoboFile
27
     */
28
    private $roboCommandFileInstance;
29
30
    protected function _before()
31
    {
32
        $container = Robo::createDefaultContainer();
33
34
        $this->app = $container->get('application');
35
        $config = $container->get('config');
0 ignored issues
show
$config is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
36
        $this->commandFactory = $container->get('commandFactory');
37
        $this->roboCommandFileInstance = new TestedRoboFile;
38
        $builder = CollectionBuilder::create($container, $this->roboCommandFileInstance);
39
        $this->roboCommandFileInstance->setBuilder($builder);
40
        $commandList = $this->commandFactory->createCommandsFromClass($this->roboCommandFileInstance);
41
        foreach ($commandList as $command) {
42
            $this->app->add($command);
43
        }
44
    }
45
46
    public function testTaskAccessor()
47
    {
48
        // Get a reference to the protected 'task' method, as
49
        // this is normally only callable by methods of the
50
        // commandfile instance.
51
        $method = new ReflectionMethod($this->roboCommandFileInstance, 'task');
52
        $method->setAccessible(true);
53
        $collectionBuilder = $method->invoke($this->roboCommandFileInstance, 'Robo\Task\Base\Exec', 'ls');
54
        $this->assertEquals(
55
            'Robo\Collection\CollectionBuilder',
56
            get_class($collectionBuilder));
57
        $task = $collectionBuilder->getCollectionBuilderCurrentTask();
58
        $this->assertEquals(
59
            'Robo\Task\Base\Exec',
60
            get_class($task));
61
        $this->assertEquals(
62
            'Robo\Task\Base\Exec',
63
            get_class($task));
64
    }
65
66
    public function testAllowEmptyValuesAsDefaultsToOptionalOptions()
67
    {
68
        $command = $this->createCommand('hello');
69
70
        $yell = $command->getDefinition()->getOption('yell');
71
72
        $this->assertFalse($yell->isValueOptional());
73
        $this->assertFalse($yell->getDefault());
74
75
        $to = $command->getDefinition()->getOption('to');
76
77
        $this->assertTrue($to->isValueOptional());
78
        $this->assertNull($to->getDefault());
79
    }
80
81
    public function testCommandDocumentation()
82
    {
83
        $command = $this->createCommand('fibonacci');
84
85
        $this->assertEquals(
86
            'Calculate the fibonacci sequence between two numbers.',
87
            $command->getDescription());
88
    }
89
90
    public function testCommandCompactDocumentation()
91
    {
92
        $command = $this->createCommand('compact');
93
94
        $this->assertEquals(
95
            'Compact doc comment',
96
            $command->getDescription());
97
    }
98
99
    public function testCommandArgumentDocumentation()
100
    {
101
        $command = $this->createCommand('fibonacci');
102
103
        $start = $command->getDefinition()->getArgument('start');
104
105
        $this->assertEquals(
106
            'Number to start from',
107
            $start->getDescription());
108
109
        $steps = $command->getDefinition()->getArgument('steps');
110
111
        $this->assertEquals(
112
            'Number of steps to perform',
113
            $steps->getDescription());
114
    }
115
116
    public function testCommandOptionDocumentation()
117
    {
118
        $command = $this->createCommand('fibonacci');
119
120
        $graphic = $command->getDefinition()->getOption('graphic');
121
122
        $this->assertEquals(
123
            'Display the sequence graphically using cube representation',
124
            $graphic->getDescription());
125
    }
126
127
    public function testCommandHelpDocumentation()
128
    {
129
        $command = $this->createCommand('fibonacci');
130
131
        $this->assertContains(
132
            '+----+---+',
133
            $command->getHelp());
134
    }
135
136
    public function testCommandNaming()
137
    {
138
        $this->assertNotNull($this->app->find('generate:user-avatar'));
139
    }
140
141
    protected function createCommand($name)
142
    {
143
        $commandInfo = new CommandInfo($this->roboCommandFileInstance, $name);
144
        return $this->commandFactory->createCommand($commandInfo, $this->roboCommandFileInstance);
145
    }
146
}
147