Issues (3)

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/commands/Git.php (1 issue)

Labels
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
3
4
namespace Genesis\Commands;
5
6
7
use Genesis\InvalidArgumentException;
8
9
10
/**
11
 * @author Adam Bisek <[email protected]>
12
 */
13
class Git extends Command
14
{
15
16
	/** @var string */
17
	private $gitExecutable = 'git';
18
19
	private $command;
20
21
	private $workingDirectory;
22
23
	/**
24
	 * Redirect stderr to stdout? - for testing purposes only
25
	 * Git writes his progressive output do stderr (even if everything ok) - at least when clonning
26
	 * @var bool
27
	 */
28
	private $redirectStderrToStdout = FALSE;
29
30
31
	/**
32
	 * Returns path to git executable
33
	 * @return string
34
	 */
35 1
	public function getGitExecutable()
36
	{
37 1
		return $this->gitExecutable;
38
	}
39
40
41
	/**
42
	 * Sets path to git executable
43
	 * @param string $gitExecutable
44
	 */
45 2
	public function setGitExecutable($gitExecutable)
46
	{
47 2
		if ($gitExecutable == '') {
48 1
			throw new InvalidArgumentException("Git executable cannot be empty.");
49
		}
50 1
		$this->gitExecutable = $gitExecutable;
51 1
	}
52
53
54
	/**
55
	 * @return string
56
	 */
57 1
	public function getWorkingDirectory()
58
	{
59 1
		return $this->workingDirectory;
60
	}
61
62
63
	/**
64
	 * Sets path to working directory
65
	 * @param string $workingTree
0 ignored issues
show
There is no parameter named $workingTree. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
66
	 */
67 2
	public function setWorkingDirectory($workingDirectory)
68
	{
69 2
		$this->workingDirectory = $workingDirectory;
70 2
	}
71
72
73
	/**
74
	 * @return boolean
75
	 */
76 1
	public function isRedirectStderrToStdout()
77
	{
78 1
		return $this->redirectStderrToStdout;
79
	}
80
81
82
	/**
83
	 * @param boolean $redirectStderrToStdout
84
	 */
85 2
	public function setRedirectStderrToStdout($redirectStderrToStdout)
86
	{
87 2
		$this->redirectStderrToStdout = $redirectStderrToStdout;
88 2
	}
89
90
91
	/**
92
	 * Return setted git command
93
	 * @return mixed
94
	 */
95 1
	public function getCommand()
96
	{
97 1
		return $this->command;
98
	}
99
100
101
	/**
102
	 * Sets git command (to be executed later)
103
	 * @param mixed $command
104
	 */
105 3
	public function setCommand($command)
106
	{
107 3
		$this->command = $command;
108 3
	}
109
110
111
	/**
112
	 * Sets git command for cloning repository (to be executed later)
113
	 */
114 1
	public function cloneRepo($url, $branch = NULL, $dir = NULL)
115
	{
116 1
		$command = "clone";
117 1
		$command .= " --depth 1 --recursive $url";
118 1
		$command .= ($branch ? " --branch $branch" : '');
119 1
		$command .= ($dir ? ' ' . escapeshellarg($dir) : '');
120 1
		$this->setCommand($command);
121 1
	}
122
123
124
	/**
125
	 * @return ExecResult
126
	 */
127 2
	public function execute()
128
	{
129 2
		$command = '';
130 2
		if ($this->workingDirectory !== NULL) {
131 1
			$command .= 'cd ' . escapeshellarg($this->workingDirectory) . ' && ';
132 1
		}
133 2
		$command .= escapeshellarg($this->gitExecutable);
134 2
		$execCommand = $command . ' ' . $this->command;
135 2
		if ($this->redirectStderrToStdout) {
136 1
			$execCommand .= ' 2>&1';
137 1
		}
138 2
		return $this->exec($execCommand);
139
	}
140
141
142 2
	private function exec($command)
143
	{
144 2
		$exec = new Exec();
145 2
		$exec->setCommand($command);
146 2
		return $exec->execute();
147
	}
148
149
}