Issues (493)

Security Analysis    not enabled

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/vobject/groupproperty.php (4 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
 * ownCloud - VObject Group Property
4
 *
5
 * @author Thomas Tanghus
6
 * @copyright 2013-2014 Thomas Tanghus ([email protected])
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
 * License as published by the Free Software Foundation; either
11
 * version 3 of the License, or any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public
19
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
23
namespace OCA\Contacts\VObject;
24
25
use OC\VObject\CompoundProperty;
26
27
/**
28
 * This class adds convenience methods for the CATEGORIES property.
29
 *
30
 * NOTE: Group names are case-insensitive.
31
 */
32
class GroupProperty extends \Sabre\VObject\Property\Text {
33
34
	/**
35
	* Add a group.
36
	*
37
	* NOTE: We cannot just use add() as that method name is used in
38
	* \Sabre\VObject\Property
39
	*
40
	* @param string $name
41
	* @return bool
42
	*/
43 1 View Code Duplication
	public function addGroup($name) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44 1
		$name = trim($name);
45 1
		if($this->hasGroup($name)) {
46
			return false;
47
		}
48 1
		$groups = $this->getParts();
49
		// Remove empty elements
50 1
		$groups = array_filter($groups, 'strlen');
51 1
		$groups[] = $name;
52 1
		$this->setParts($groups);
53 1
		return true;
54
	}
55
56
	/**
57
	* Remove an existing group.
58
	*
59
	* @param string $name
60
	* @return bool
61
	*/
62 1 View Code Duplication
	public function removeGroup($name) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63 1
		$name = trim($name);
64 1
		if(!$this->hasGroup($name)) {
65
			return false;
66
		}
67 1
		$groups = $this->getParts();
68 1
		$groups = array_map('trim', $groups);
69 1
		array_splice($groups, $this->array_searchi($name, $groups), 1);
70 1
		$this->setParts($groups);
71 1
		return true;
72
	}
73
74
	/**
75
	* Test it a group by that name exists.
76
	*
77
	* @param string $name
78
	* @return bool
79
	*/
80 1
	public function hasGroup($name) {
81 1
		$name = trim($name);
82 1
		$groups = $this->getParts();
83 1
		$groups = array_map('trim', $groups);
84 1
		return $this->in_arrayi($name, $groups);
85
	}
86
87
	/**
88
	* Rename an existing group.
89
	*
90
	* @param string $from
91
	* @param string $to
92
	*/
93 1
	public function renameGroup($from, $to) {
94 1
		$from = trim($from);
95 1
		$to = trim($to);
96 1
		if(!$this->hasGroup($from)) {
97
			return;
98
		}
99 1
		$groups = $this->getParts();
100 1
		$groups = array_map('trim', $groups);
101 1
		$groups[$this->array_searchi($from, $groups)] = $to;
102 1
		$this->setParts($groups);
103 1
	}
104
105
	// case-insensitive in_array
106 1
	protected function in_arrayi($needle, $haystack) {
0 ignored issues
show
Coding Style Naming introduced by
The method in_arrayi is not named in camelCase.

This check marks method names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
107 1
		if(!is_array($haystack)) {
108
			return false;
109
		}
110 1
		return in_array(strtolower($needle), array_map('strtolower', $haystack));
111
	}
112
113
	// case-insensitive array_search
114 1
	protected function array_searchi($needle, $haystack) {
0 ignored issues
show
Coding Style Naming introduced by
The method array_searchi is not named in camelCase.

This check marks method names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
115 1
		if(!is_array($haystack)) {
116
			return false;
117
		}
118 1
		return array_search(strtolower($needle), array_map('strtolower', $haystack));
119
	}
120
}
121