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.

tests/unit/lib/vobjectTest.php (5 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) 2013 Thomas Tanghus ([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
use Test\TestCase;
10
11
/**
12
 * Class Test_VObjects
13
 * @group DB
14
 */
15
class Test_VObjects extends TestCase {
0 ignored issues
show
The class Test_VObjects is not named in CamelCase.

This check marks class 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. The whole name starts with a capital letter as well.

Thus the name database connector becomes DatabaseConnector.

Loading history...
16
17
	public static function setUpBeforeClass() {
18
		parent::setUpBeforeClass();
19
		\Sabre\VObject\Component\VCard::$propertyMap['CATEGORIES'] = 'OCA\Contacts\VObject\GroupProperty';
20
	}
21
22 View Code Duplication
	public function testCrappyVCard() {
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...
23
		$cardData = file_get_contents(__DIR__ . '/../data/test3.vcf');
24
		$obj = \Sabre\VObject\Reader::read(
25
			$cardData,
26
			\Sabre\VObject\Reader::OPTION_IGNORE_INVALID_LINES
27
		);
28
		$obj->validate($obj::REPAIR);
29
30
		$this->assertEquals('2.1', (string)$obj->VERSION);
31
		$this->assertEquals('Adèle Fermée', (string)$obj->FN);
32
		$this->assertEquals('Fermée;Adèle;;;', (string)$obj->N);
33
	}
34
35 View Code Duplication
	public function testEscapedParameters() {
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...
36
		$cardData = file_get_contents(__DIR__ . '/../data/test6.vcf');
37
		$obj = \Sabre\VObject\Reader::read(
38
			$cardData,
39
			\Sabre\VObject\Reader::OPTION_IGNORE_INVALID_LINES
40
		);
41
		$obj->validate($obj::REPAIR);
42
43
		$this->assertEquals('3.0', (string)$obj->VERSION);
44
		$this->assertEquals('Parameters;Escaped;;;', (string)$obj->N);
45
		$this->assertEquals('TEL;TYPE=PREF\,WORK\,VOICE:123456789' . "\r\n", $obj->TEL->serialize());
46
	}
47
48
	public function testGroupProperty() {
49
		$arr = array(
50
			'Home',
51
			'work',
52
			'Friends, Family',
53
		);
54
55
		$vcard = new \OCA\Contacts\VObject\VCard();
0 ignored issues
show
The call to VCard::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
56
57
		$property = $vcard->createProperty('CATEGORIES');
0 ignored issues
show
The method createProperty() does not exist on OCA\Contacts\VObject\VCard. Did you maybe mean create()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
58
		$property->setParts($arr);
59
60
		// Test parsing and serializing
61
		$this->assertEquals('Home,work,Friends\, Family', $property->getValue());
62
		$this->assertEquals('CATEGORIES:Home,work,Friends\, Family' . "\r\n", $property->serialize());
63
		$this->assertEquals(3, count($property->getParts()));
64
65
		// Test add
66
		$property->addGroup('Coworkers');
67
		$this->assertTrue($property->hasGroup('coworkers'));
68
		$this->assertEquals(4, count($property->getParts()));
69
		$this->assertEquals('Home,work,Friends\, Family,Coworkers', $property->getValue());
70
71
		// Test remove
72
		$this->assertTrue($property->hasGroup('Friends, fAmIlY'));
73
		$property->removeGroup('Friends, fAmIlY');
74
		$this->assertEquals(3, count($property->getParts()));
75
		$parts = $property->getParts();
76
		$this->assertEquals('Coworkers', $parts[2]);
77
78
		// Test rename
79
		$property->renameGroup('work', 'Work');
80
		$parts = $property->getParts();
81
		$this->assertEquals('Work', $parts[1]);
82
		//$this->assertEquals(true, false);
83
	}
84
}
85