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/ItemMapper.php (7 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\DoesNotExistException;
12
use OCP\AppFramework\Db\Entity;
13
use OCP\AppFramework\Db\Mapper;
14
use OCP\IDBConnection;
15
16
class ItemMapper 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...
17
	public function __construct(IDBConnection $db) {
18
		parent::__construct($db, 'files_antivirus', Item::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...
19
	}
20
21
	/**
22
	 * Find rule by id
23
	 * @param int $fileid
24
	 * @return Rule
25
	 * @throws DoesNotExistException
26
	 */
27
	public function findByFileId($fileid) {
28
		$sql = 'SELECT * FROM ' . $this->getTableName() .' WHERE fileid = ?';
0 ignored issues
show
Deprecated Code introduced by
The method OCP\AppFramework\Db\Mapper::getTableName() 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...
29
		return $this->findEntity($sql, [$fileid]);
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...
30
	}
31
32
	public function delete(Entity $entity) {
33
		if (!($entity instanceof Item)) {
34
			throw new \InvalidArgumentException();
35
		}
36
37
		$qb = $this->db->getQueryBuilder();
38
39
		$qb->delete('files_antivirus')
40
			->where(
41
				$qb->expr()->eq('fileid', $qb->createNamedParameter($entity->getFileid()))
42
			);
43
		$qb->execute();
0 ignored issues
show
Deprecated Code introduced by
The method OCP\DB\QueryBuilder\IQueryBuilder::execute() has been deprecated with message: 22.0.0 Use executeQuery or executeUpdate

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
		return $entity;
46
	}
47
48
	/**
49
	 * Creates a new entry in the db from an entity
50
	 * @param Entity $entity the entity that should be created
51
	 * @return Entity the saved entity with the set id
52
	 * @since 7.0.0
53
	 * @deprecated 14.0.0 Move over to QBMapper
54
	 */
55
	public function insert(Entity $entity) {
56
		// get updated fields to save, fields have to be set using a setter to
57
		// be saved
58
		$properties = $entity->getUpdatedFields();
59
		$values = '';
60
		$columns = '';
61
		$params = [];
62
63
		// build the fields
64
		$i = 0;
65
		foreach ($properties as $property => $updated) {
66
			$column = $entity->propertyToColumn($property);
67
			$getter = 'get' . ucfirst($property);
68
69
			$columns .= '`' . $column . '`';
70
			$values .= '?';
71
72
			// only append colon if there are more entries
73
			if ($i < count($properties) - 1) {
74
				$columns .= ',';
75
				$values .= ',';
76
			}
77
78
			$params[] = $entity->$getter();
79
			$i++;
80
		}
81
82
		$sql = 'INSERT INTO `' . $this->tableName . '`(' .
83
			$columns . ') VALUES(' . $values . ')';
84
85
		$stmt = $this->execute($sql, $params);
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...
86
87
		$stmt->closeCursor();
0 ignored issues
show
Deprecated Code introduced by
The method OCP\DB\IPreparedStatement::closeCursor() has been deprecated with message: 21.0.0 use \OCP\DB\IResult::closeCursor on the \OCP\DB\IResult returned by \OCP\IDBConnection::prepare

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...
88
89
		return $entity;
90
	}
91
}
92