Issues (50)

Security Analysis    no request data  

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/Cli/SiteAliasCommands.php (6 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 Consolidation\SiteAlias\Cli;
4
5
use Consolidation\SiteAlias\SiteAliasFileLoader;
6
use Consolidation\SiteAlias\SiteAliasManager;
7
use Consolidation\SiteAlias\Util\YamlDataFileLoader;
8
use Consolidation\SiteAlias\SiteSpecParser;
9
use Consolidation\SiteAlias\SiteAliasName;
10
11
class SiteAliasCommands extends \Robo\Tasks
12
{
13
    protected $aliasLoader;
14
15
    /**
16
     * List available site aliases.
17
     *
18
     * @command site:list
19
     * @format yaml
20
     * @return array
21
     */
22
    public function siteList(array $varArgs)
23
    {
24
        $this->aliasLoader = new SiteAliasFileLoader();
25
        $ymlLoader = new YamlDataFileLoader();
26
        $this->aliasLoader->addLoader('yml', $ymlLoader);
27
        $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader);
0 ignored issues
show
The call to SiteAliasCommands::getLocationsAndAliasName() has too many arguments starting with $this->aliasLoader.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
28
29
        $this->manager = new SiteAliasManager($this->aliasLoader);
30
31
        return $this->renderAliases($this->manager->getMultiple($aliasName));
32
    }
33
34
    /**
35
     * Load available site aliases.
36
     *
37
     * @command site:load
38
     * @format yaml
39
     * @return array
40
     */
41
    public function siteLoad(array $dirs)
42
    {
43
        $this->aliasLoader = new SiteAliasFileLoader();
44
        $ymlLoader = new YamlDataFileLoader();
45
        $this->aliasLoader->addLoader('yml', $ymlLoader);
46
47
        foreach ($dirs as $dir) {
48
            $this->io()->note("Add search location: $dir");
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\IO::io() has been deprecated with message: Use a style injector 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...
49
            $this->aliasLoader->addSearchLocation($dir);
50
        }
51
52
        $all = $this->aliasLoader->loadAll();
53
54
        return $this->renderAliases($all);
55
    }
56
57
    protected function getLocationsAndAliasName($varArgs)
58
    {
59
        $aliasName = '';
60
        foreach ($varArgs as $arg) {
61
            if (SiteAliasName::isAliasName($arg)) {
62
                $this->io()->note("Alias parameter: '$arg'");
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\IO::io() has been deprecated with message: Use a style injector 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...
63
                $aliasName = $arg;
64
            } else {
65
                $this->io()->note("Add search location: $arg");
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\IO::io() has been deprecated with message: Use a style injector 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...
66
                $this->aliasLoader->addSearchLocation($arg);
67
            }
68
        }
69
        return $aliasName;
70
    }
71
72
    protected function renderAliases($all)
73
    {
74
        if (empty($all)) {
75
            throw new \Exception("No aliases found");
76
        }
77
78
        $result = [];
79
        foreach ($all as $name => $alias) {
80
            $result[$name] = $alias->export();
81
        }
82
83
        return $result;
84
    }
85
86
    /**
87
     * Show contents of a single site alias.
88
     *
89
     * @command site:get
90
     * @format yaml
91
     * @return array
92
     */
93
    public function siteGet(array $varArgs)
94
    {
95
        $this->aliasLoader = new SiteAliasFileLoader();
96
        $ymlLoader = new YamlDataFileLoader();
97
        $this->aliasLoader->addLoader('yml', $ymlLoader);
98
        $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader);
0 ignored issues
show
The call to SiteAliasCommands::getLocationsAndAliasName() has too many arguments starting with $this->aliasLoader.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
99
100
        $manager = new SiteAliasManager($this->aliasLoader);
101
        $result = $manager->get($aliasName);
102
        if (!$result) {
103
            throw new \Exception("No alias found");
104
        }
105
106
        return $result->export();
107
    }
108
109
    /**
110
     * Access a value from a single alias.
111
     *
112
     * @command site:value
113
     * @format yaml
114
     * @return string
115
     */
116
    public function siteValue(array $varArgs)
117
    {
118
        $this->aliasLoader = new SiteAliasFileLoader();
119
        $ymlLoader = new YamlDataFileLoader();
120
        $this->aliasLoader->addLoader('yml', $ymlLoader);
121
        $key = array_pop($varArgs);
122
        $aliasName = $this->getLocationsAndAliasName($varArgs, $this->aliasLoader);
0 ignored issues
show
The call to SiteAliasCommands::getLocationsAndAliasName() has too many arguments starting with $this->aliasLoader.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
123
124
        $manager = new SiteAliasManager($this->aliasLoader);
125
        $result = $manager->get($aliasName);
126
        if (!$result) {
127
            throw new \Exception("No alias found");
128
        }
129
130
        return $result->get($key);
131
    }
132
133
    /**
134
     * Parse a site specification.
135
     *
136
     * @command site-spec:parse
137
     * @format yaml
138
     * @return array
139
     */
140
    public function parse($spec, $options = ['root' => ''])
141
    {
142
        $parser = new SiteSpecParser();
143
        return $parser->parse($spec, $options['root']);
144
    }
145
}
146