Issues (283)

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/Adapter/IOOutput.php (2 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
/*
4
 * This file is part of the webmozart/console package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\Console\Adapter;
13
14
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
use Webmozart\Console\Api\IO\IO;
17
use Webmozart\Console\Formatter\AnsiFormatter;
18
19
/**
20
 * Adapts an {@link IO} instance to Symfony's {@link OutputInterface} API.
21
 *
22
 * @since  1.0
23
 *
24
 * @author Bernhard Schussek <[email protected]>
25
 */
26
class IOOutput implements OutputInterface
27
{
28
    /**
29
     * @var IO
30
     */
31
    private $io;
32
33
    /**
34
     * @var bool
35
     */
36
    private $decorated;
37
38
    /**
39
     * Creates a new composite output.
40
     *
41
     * @param IO $io The I/O.
42
     */
43 32
    public function __construct(IO $io)
44
    {
45 32
        $this->io = $io;
46 32
        $this->decorated = $this->io->getFormatter() instanceof AnsiFormatter;
47 32
    }
48
49
    /**
50
     * Returns the standard output.
51
     *
52
     * @return IO The standard output.
53
     */
54
    public function getIO()
55
    {
56
        return $this->io;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 18
    public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
63
    {
64 18
        foreach ((array) $messages as $message) {
65 18
            if ($newline) {
66 2
                $this->doWriteLine($message, $type);
67
            } else {
68 18
                $this->doWrite($message, $type);
69
            }
70
        }
71 18
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 2
    public function writeln($messages, $type = self::OUTPUT_NORMAL)
77
    {
78 2
        foreach ((array) $messages as $message) {
79 2
            $this->doWriteLine($message, $type);
80
        }
81 2
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86 5
    public function setVerbosity($level)
87
    {
88
        switch ($level) {
89 5
            case self::VERBOSITY_QUIET:
90 1
                $this->io->setQuiet(true);
91 1
                break;
92 4
            case self::VERBOSITY_NORMAL:
93 1
                $this->io->setQuiet(false);
94 1
                $this->io->setVerbosity(IO::NORMAL);
95 1
                break;
96 3
            case self::VERBOSITY_VERBOSE:
97 1
                $this->io->setQuiet(false);
98 1
                $this->io->setVerbosity(IO::VERBOSE);
99 1
                break;
100 2
            case self::VERBOSITY_VERY_VERBOSE:
101 1
                $this->io->setQuiet(false);
102 1
                $this->io->setVerbosity(IO::VERY_VERBOSE);
103 1
                break;
104 1
            case self::VERBOSITY_DEBUG:
105 1
                $this->io->setQuiet(false);
106 1
                $this->io->setVerbosity(IO::DEBUG);
107 1
                break;
108
        }
109 5
    }
110
111
    /**
112
     * {@inheritdoc}
113
     */
114 5
    public function getVerbosity()
115
    {
116 5
        if ($this->isQuiet()) {
117 1
            return self::VERBOSITY_QUIET;
118
        }
119
120 4
        if ($this->isDebug()) {
121 1
            return self::VERBOSITY_DEBUG;
122
        }
123
124 3
        if ($this->isVeryVerbose()) {
125 1
            return self::VERBOSITY_VERY_VERBOSE;
126
        }
127
128 2
        if ($this->isVerbose()) {
129 1
            return self::VERBOSITY_VERBOSE;
130
        }
131
132 1
        return self::VERBOSITY_NORMAL;
133
    }
134
135
    /**
136
     * {@inheritdoc}
137
     */
138 5
    public function isQuiet()
139
    {
140 5
        return $this->io->isQuiet();
141
    }
142
143
    /**
144
     * {@inheritdoc}
145
     */
146 2
    public function isVerbose()
147
    {
148 2
        return $this->io->isVerbose();
149
    }
150
151
    /**
152
     * {@inheritdoc}
153
     */
154 3
    public function isVeryVerbose()
155
    {
156 3
        return $this->io->isVeryVerbose();
157
    }
158
159
    /**
160
     * {@inheritdoc}
161
     */
162 4
    public function isDebug()
163
    {
164 4
        return $this->io->isDebug();
165
    }
166
167
    /**
168
     * {@inheritdoc}
169
     */
170 1
    public function setDecorated($decorated)
171
    {
172 1
        $this->decorated = $decorated;
173 1
    }
174
175
    /**
176
     * {@inheritdoc}
177
     */
178 1
    public function isDecorated()
179
    {
180 1
        return $this->decorated;
181
    }
182
183
    /**
184
     * {@inheritdoc}
185
     */
186
    public function setFormatter(OutputFormatterInterface $formatter)
187
    {
188
    }
189
190
    /**
191
     * {@inheritdoc}
192
     */
193 1
    public function getFormatter()
194
    {
195 1
        return new FormatterAdapter($this->io);
196
    }
197
198 4 View Code Duplication
    private function doWriteLine($message, $type)
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...
199
    {
200
        switch ($type) {
201 4
            case self::OUTPUT_PLAIN:
202
                $this->io->writeLine($this->io->removeFormat($message));
203
                break;
204 4
            case self::OUTPUT_RAW:
205
                $this->io->writeLineRaw($message);
206
                break;
207
            default:
208 4
                $this->io->writeLine($message);
209 4
                break;
210
        }
211 4
    }
212
213 16 View Code Duplication
    private function doWrite($message, $type)
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...
214
    {
215
        switch ($type) {
216 16
            case self::OUTPUT_PLAIN:
217 1
                $this->io->write($this->io->removeFormat($message));
218 1
                break;
219 15
            case self::OUTPUT_RAW:
220 13
                $this->io->writeRaw($message);
221 13
                break;
222
            default:
223 2
                $this->io->write($message);
224 2
                break;
225
        }
226 16
    }
227
}
228