Issues (201)

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.

includes/Console/Command/Cache.php (1 issue)

unparsable_code_with_line

Bug Critical

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 Redaxscript\Console\Command;
3
4
use Redaxscript\Console\Parser;
5
use Redaxscript\Filesystem;
6
use function array_key_exists;
7
use function is_dir;
8
use function is_object;
9
10
/**
11
 * children class to execute the cache command
12
 *
13
 * @since 3.0.0
14
 *
15
 * @package Redaxscript
16
 * @category Console
17
 * @author Henry Ruhs
18
 */
19
20
class Cache extends CommandAbstract
21
{
22
	/**
23
	 * array of the command
24
	 *
25
	 * @var array
26
	 */
27
28
	protected array $_commandArray =
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_ARRAY, expecting T_FUNCTION or T_CONST
Loading history...
29
	[
30
		'cache' =>
31
		[
32
			'description' => 'Cache command',
33
			'argumentArray' =>
34
			[
35
				'clear' =>
36
				[
37
					'description' => 'Clear the cache',
38
					'optionArray' =>
39
					[
40
						'directory' =>
41
						[
42
							'description' => 'Required directory of the cache'
43
						],
44
						'extension' =>
45
						[
46
							'description' => 'Required extension of the cache files'
47
						],
48
						'bundle' =>
49
						[
50
							'description' => 'Optional key or collection of the bundle'
51
						]
52
					]
53
				],
54
				'clear-invalid' =>
55
				[
56
					'description' => 'Clear the invalid cache',
57
					'optionArray' =>
58
					[
59
						'directory' =>
60
						[
61
							'description' => 'Required directory of the cache'
62
						],
63
						'extension' =>
64
						[
65
							'description' => 'Required extension of the cache files'
66
						],
67
						'lifetime' =>
68
						[
69
							'description' => 'Optional lifetime of the bundle'
70
						]
71
					]
72
				]
73
			]
74
		]
75
	];
76
77
	/**
78
	 * run the command
79
	 *
80
	 * @param string $mode name of the mode
81
	 *
82
	 * @since 3.0.0
83
	 *
84
	 * @return string|null
85
	 */
86
87 5
	public function run(string $mode = null) : ?string
88
	{
89 5
		$parser = new Parser($this->_request);
90 5
		$parser->init($mode);
91
92
		/* run command */
93
94 5
		$argumentKey = $parser->getArgument(1);
95 5
		$haltOnError = (bool)$parser->getOption('halt-on-error');
96 5
		if ($argumentKey === 'clear')
97
		{
98 2
			return $this->_clear($parser->getOptionArray()) ? $this->success() : $this->error($haltOnError);
99
		}
100 3
		if ($argumentKey === 'clear-invalid')
101
		{
102 2
			return $this->_clearInvalid($parser->getOptionArray()) ? $this->success() : $this->error($haltOnError);
103
		}
104 1
		return $this->getHelp();
105
	}
106
107
	/**
108
	 * clear the cache
109
	 *
110
	 * @since 3.0.0
111
	 *
112
	 * @param array $optionArray
113
	 *
114
	 * @return bool
115
	 */
116
117 2
	protected function _clear(array $optionArray = []) : bool
118
	{
119 2
		$directory = $this->prompt('directory', $optionArray);
120 2
		$extension = $this->prompt('extension', $optionArray);
121 2
		if (is_dir($directory))
122
		{
123 1
			$cacheFilesystem = new Filesystem\Cache();
124 1
			return is_object($cacheFilesystem->init($directory, $extension)->clear($optionArray['bundle']));
125
		}
126 1
		return false;
127
	}
128
129
	/**
130
	 * clear the invalid cache
131
	 *
132
	 * @since 3.0.0
133
	 *
134
	 * @param array $optionArray
135
	 *
136
	 * @return bool
137
	 */
138
139 2
	protected function _clearInvalid(array $optionArray = []) : bool
140
	{
141 2
		$directory = $this->prompt('directory', $optionArray);
142 2
		$extension = $this->prompt('extension', $optionArray);
143 2
		$lifetime = array_key_exists('lifetime', $optionArray) ? $optionArray['lifetime'] : 3600;
144 2
		if (is_dir($directory))
145
		{
146 1
			$cacheFilesystem = new Filesystem\Cache();
147 1
			return is_object($cacheFilesystem->init($directory, $extension)->clearInvalid($lifetime));
148
		}
149 1
		return false;
150
	}
151
}
152