Issues (22)

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/Util/RealtimeOutputHandler.php (1 issue)

Severity

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
namespace Consolidation\SiteProcess\Util;
3
4
use Symfony\Component\Process\Process;
5
use Consolidation\Config\Util\Interpolator;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use Symfony\Component\Console\Output\NullOutput;
8
9
/**
10
 * RealtimeOutput can be provided to a process object when you want
11
 * to display the output of the running command as it is being produced.
12
 */
13
class RealtimeOutputHandler
14
{
15
    protected $stdout;
16
    protected $stderr;
17
    protected $stdoutMarker = '';
18
    protected $stderrMarker = '';
19
20
    /**
21
     * Provide the output streams to use for stdout and stderr
22
     */
23
    const MARKER_ERR = '> ';
24
25
    public function __construct(OutputInterface $stdout, OutputInterface $stderr)
26
    {
27
        $this->stdout = $stdout;
28
        $this->stderr = $stderr;
29
30
        $this->stdoutMarker = '';
31
        $this->stderrMarker = self::MARKER_ERR;
32
    }
33
34
    /**
35
     * This gives us an opportunity to adapt to the settings of the
36
     * process object (e.g. do we need to do anything differently if
37
     * it is in tty mode, etc.)
38
     */
39
    public function configure(Process $process)
0 ignored issues
show
The parameter $process is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return $this;
42
    }
43
44
    /**
45
     * setStderrMarker defines the string that should be added at
46
     * the beginning of every line of stderr that is printed.
47
     */
48
    public function setStderrMarker($marker)
49
    {
50
        $this->stderrMarker = $marker;
51
        return $this;
52
    }
53
54
    /**
55
     * setStdoutMarker defines the string that should be added at
56
     * the beginning of every line of stdout that is printed.
57
     */
58
    public function setStdoutMarker($marker)
59
    {
60
        $this->stdoutMarker = $marker;
61
        return $this;
62
    }
63
64
    /**
65
     * hideStdout overrides whatever was formerly stored in $this->stdout
66
     * with a null output buffer so that none of the standard output data
67
     * is visible.
68
     */
69
    public function hideStdout()
70
    {
71
        $this->stdout = new NullOutput();
72
        $this->stdoutMarker = '';
73
        return $this;
74
    }
75
76
    /**
77
     * hideStderr serves the same function as hideStdout, but for the
78
     * standard error stream. Note that it is not useful to unconditionally
79
     * call both hideStdout and hideStderr; if no output is desired, then
80
     * the RealtimeOutputHandler should not be used.
81
     */
82
    public function hideStderr()
83
    {
84
        $this->stderr = new NullOutput();
85
        $this->stderrMarker = '';
86
        return $this;
87
    }
88
89
    /**
90
     * If this object is used as a callable, then run 'handleOutput'.
91
     */
92
    public function __invoke($type, $buffer)
93
    {
94
        $this->handleOutput($type, $buffer);
95
    }
96
97
    /**
98
     * Helper method when you want real-time output from a Process call.
99
     * @param string $type
100
     * @param string $buffer
101
     */
102
    public function handleOutput($type, $buffer)
103
    {
104
        if (Process::ERR === $type) {
105
            $this->stderr->write($this->addMarker($buffer, $this->stderrMarker), false, OutputInterface::OUTPUT_RAW);
106
        } else {
107
            $this->stdout->write($this->addMarker($buffer, $this->stdoutMarker), false, OutputInterface::OUTPUT_RAW);
108
        }
109
    }
110
111
    /**
112
     * Make sure that every line in $buffer begins with a MARKER_ERR.
113
     */
114
    protected function addMarker($buffer, $marker)
115
    {
116
        // Exit early if there is no marker to add
117
        if (empty($marker)) {
118
            return $buffer;
119
        }
120
        // Add a marker on the beginning of every line.
121
        return $marker . rtrim(implode("\n" . $marker, explode("\n", $buffer)), $marker);
122
    }
123
}
124