Issues (78)

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.

lib/Db/RuleMapper.php (8 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
 * Copyright (c) 2015 Victor Dubiniuk <[email protected]>
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later.
6
 * See the COPYING-README file.
7
 */
8
9
namespace OCA\Files_Antivirus\Db;
10
11
use OCP\AppFramework\Db\Mapper;
12
use OCP\IDBConnection;
13
14
class RuleMapper extends Mapper {
0 ignored issues
show
Deprecated Code introduced by
The class OCP\AppFramework\Db\Mapper has been deprecated with message: 14.0.0 Move over to QBMapper

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
15 2
	public function __construct(IDBConnection $db) {
16 2
		parent::__construct($db, 'files_avir_status', Rule::class);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::__construct() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
17 2
	}
18
	
19
	/**
20
	 * Empty the table
21
	 * @return bool
22
	 */
23 1
	public function deleteAll() {
24 1
		$sql = 'DELETE FROM `*PREFIX*files_avir_status`';
25 1
		return $this->execute($sql);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::execute() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
26
	}
27
	
28
	/**
29
	 * Find rule by id
30
	 * @param int $id
31
	 * @return Rule
32
	 */
33
	public function find($id) {
34
		$sql = 'SELECT * FROM *PREFIX*files_avir_status WHERE id = ?';
35
		return $this->findEntity($sql, [$id]);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::findEntity() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
36
	}
37
	
38
	/**
39
	 * Get all rules
40
	 */
41
	public function findAll() {
42
		$sql = 'SELECT * FROM `*PREFIX*files_avir_status`';
43
		return $this->findEntities($sql);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::findEntities() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
44
	}
45
46
	/**
47
	 * Get collection of rules by given exit code
48
	 * @param int $result
49
	 * @return array
50
	 */
51 1
	public function findByResult($result) {
52 1
		$sql = 'SELECT * FROM `*PREFIX*files_avir_status` WHERE `status_type`=? and `result`=?';
53 1
		return $this->findEntities($sql, [Rule::RULE_TYPE_CODE, $result]);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::findEntities() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
54
	}
55
	
56
	/**
57
	 * Get collection of rules of type Match
58
	 * @param int $status
59
	 * @return array
60
	 */
61 1
	public function findAllMatchedByStatus($status) {
62 1
		$sql = 'SELECT * FROM `*PREFIX*files_avir_status` WHERE `status_type`=? and `status`=?';
63 1
		return $this->findEntities($sql, [Rule::RULE_TYPE_MATCH, $status]);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::findEntities() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
64
	}
65
	
66
	/**
67
	 * Fill the table with rules used with clamav
68
	 */
69 1
	public function populate() {
70
		$descriptions = [
71
			[
72 1
				'groupId' => 0,
73 1
				'statusType' => Rule::RULE_TYPE_CODE,
74 1
				'result' => 0,
75 1
				'match' => '',
76 1
				'description' => '',
77 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_CLEAN
78
			],
79
80
			[
81 1
				'groupId' => 0,
82 1
				'statusType' => Rule::RULE_TYPE_CODE,
83 1
				'result' => 1,
84 1
				'match' => '',
85 1
				'description' => '',
86 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_INFECTED
87
			],
88
		
89
			[
90 1
				'groupId' => 0,
91 1
				'statusType' => Rule::RULE_TYPE_CODE,
92 1
				'result' => 40,
93 1
				'match' => '',
94 1
				'description' => 'Unknown option passed.',
95 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
96
			],
97
			
98
			[
99 1
				'groupId' => 0,
100 1
				'statusType' => Rule::RULE_TYPE_CODE,
101 1
				'result' => 50,
102 1
				'match' => '',
103 1
				'description' => 'Database initialization error.',
104 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
105
			],
106
			
107
			[
108 1
				'groupId' => 0,
109 1
				'statusType' => Rule::RULE_TYPE_CODE,
110 1
				'result' => 52,
111 1
				'match' => '',
112 1
				'description' => 'Not supported file type.',
113 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
114
			],
115
			
116
			[
117 1
				'groupId' => 0,
118 1
				'statusType' => Rule::RULE_TYPE_CODE,
119 1
				'result' => 53,
120 1
				'match' => '',
121 1
				'description' => "Can't open directory.",
122 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
123
			],
124
			
125
			[
126 1
				'groupId' => 0,
127 1
				'statusType' => Rule::RULE_TYPE_CODE,
128 1
				'result' => 54,
129 1
				'match' => '',
130 1
				'description' => "Can't open file. (ofm)",
131 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
132
			],
133
			
134
			[
135 1
				'groupId' => 0,
136 1
				'statusType' => Rule::RULE_TYPE_CODE,
137 1
				'result' => 55,
138 1
				'match' => '',
139 1
				'description' => 'Error reading file. (ofm)',
140 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
141
			],
142
			
143
			[
144 1
				'groupId' => 0,
145 1
				'statusType' => Rule::RULE_TYPE_CODE,
146 1
				'result' => 56,
147 1
				'match' => '',
148 1
				'description' => "Can't stat input file / directory.",
149 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
150
			],
151
			
152
			[
153 1
				'groupId' => 0,
154 1
				'statusType' => Rule::RULE_TYPE_CODE,
155 1
				'result' => 57,
156 1
				'match' => '',
157 1
				'description' => "Can't get absolute path name of current working directory.",
158 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
159
			],
160
			
161
			[
162 1
				'groupId' => 0,
163 1
				'statusType' => Rule::RULE_TYPE_CODE,
164 1
				'result' => 58,
165 1
				'match' => '',
166 1
				'description' => 'I/O error, please check your file system.',
167 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
168
			],
169
			
170
			[
171 1
				'groupId' => 0,
172 1
				'statusType' => Rule::RULE_TYPE_CODE,
173 1
				'result' => 62,
174 1
				'match' => '',
175 1
				'description' => "Can't initialize logger.",
176 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
177
			],
178
			
179
			[
180 1
				'groupId' => 0,
181 1
				'statusType' => Rule::RULE_TYPE_CODE,
182 1
				'result' => 63,
183 1
				'match' => '',
184 1
				'description' => "Can't create temporary files/directories (check permissions).",
185 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
186
			],
187
			
188
			[
189 1
				'groupId' => 0,
190 1
				'statusType' => Rule::RULE_TYPE_CODE,
191 1
				'result' => 64,
192 1
				'match' => '',
193 1
				'description' => "Can't write to temporary directory (please specify another one).",
194 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
195
			],
196
			
197
			[
198 1
				'groupId' => 0,
199 1
				'statusType' => Rule::RULE_TYPE_CODE,
200 1
				'result' => 70,
201 1
				'match' => '',
202 1
				'description' => "Can't allocate memory (calloc).",
203 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
204
			],
205
			
206
			[
207 1
				'groupId' => 0,
208 1
				'statusType' => Rule::RULE_TYPE_CODE,
209 1
				'result' => 71,
210 1
				'match' => '',
211 1
				'description' => "Can't allocate memory (malloc).",
212 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
213
			],
214
			
215
			[
216 1
				'groupId' => 0,
217 1
				'statusType' => Rule::RULE_TYPE_MATCH,
218 1
				'result' => 0,
219 1
				'match' => '/.*: OK$/',
220 1
				'description' => '',
221 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_CLEAN
222
			],
223
			
224
			[
225 1
				'groupId' => 0,
226 1
				'statusType' => Rule::RULE_TYPE_MATCH,
227 1
				'result' => 0,
228 1
				'match' => '/.*: (.*) FOUND$/',
229 1
				'description' => '',
230 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_INFECTED
231
			],
232
			
233
			[
234 1
				'groupId' => 0,
235 1
				'statusType' => Rule::RULE_TYPE_MATCH,
236 1
				'result' => 0,
237 1
				'match' => '/.*: (.*) ERROR$/',
238 1
				'description' => '',
239 1
				'status' => \OCA\Files_Antivirus\Status::SCANRESULT_UNCHECKED
240
			],
241
		];
242
		
243 1
		foreach ($descriptions as $description) {
244 1
			$rule = Rule::fromParams($description);
245 1
			$this->insert($rule);
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::insert() has been deprecated with message: 14.0.0 Move over to QBMapper

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...
246
		}
247 1
	}
248
}
249