Issues (2473)

Branch: master

Security Analysis    no vulnerabilities found

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.

engine/classes/ODDDocument.php (1 issue)

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
 * This class is used during import and export to construct.
4
 *
5
 * @package    Elgg.Core
6
 * @subpackage ODD
7
 * @deprecated 1.9
8
 */
9
class ODDDocument implements \Iterator {
10
	/**
11
	 * ODD Version
12
	 *
13
	 * @var string
14
	 */
15
	private $ODDSupportedVersion = "1.0";
16
17
	/**
18
	 * Elements of the document.
19
	 */
20
	private $elements;
21
22
	/**
23
	 * Optional wrapper factory.
24
	 */
25
	private $wrapperfactory;
26
27
	/**
28
	 * Create a new ODD Document.
29
	 *
30
	 * @param array $elements Elements to add
31
	 *
32
	 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
33
	 */
34
	public function __construct(array $elements = null) {
35
		if ($elements) {
36
			if (is_array($elements)) {
37
				$this->elements = $elements;
38
			} else {
39
				$this->addElement($elements);
40
			}
41
		} else {
42
			$this->elements = array();
43
		}
44
	}
45
46
	/**
47
	 * Return the version of ODD being used.
48
	 *
49
	 * @return string
50
	 */
51
	public function getVersion() {
52
		return $this->ODDSupportedVersion;
53
	}
54
55
	/**
56
	 * Returns the number of elements
57
	 *
58
	 * @return int
59
	 */
60
	public function getNumElements() {
61
		return count($this->elements);
62
	}
63
64
	/**
65
	 * Add an element
66
	 *
67
	 * @param ODD $element An ODD element
68
	 *
69
	 * @return void
70
	 */
71
	public function addElement(ODD $element) {
72
		if (!is_array($this->elements)) {
73
			$this->elements = array();
74
		}
75
		$this->elements[] = $element;
76
	}
77
78
	/**
79
	 * Add multiple elements at once
80
	 *
81
	 * @param array $elements Array of ODD elements
82
	 *
83
	 * @return void
84
	 */
85
	public function addElements(array $elements) {
86
		foreach ($elements as $element) {
87
			$this->addElement($element);
88
		}
89
	}
90
91
	/**
92
	 * Return all elements
93
	 *
94
	 * @return array
95
	 */
96
	public function getElements() {
97
		return $this->elements;
98
	}
99
100
	/**
101
	 * Set an optional wrapper factory to optionally embed the ODD document in another format.
102
	 *
103
	 * @param \ODDWrapperFactory $factory The factory
104
	 *
105
	 * @return void
106
	 */
107
	public function setWrapperFactory(\ODDWrapperFactory $factory) {
108
		$this->wrapperfactory = $factory;
109
	}
110
111
	/**
112
	 * Magic function to generate valid ODD XML for this item.
113
	 *
114
	 * @return string
115
	 */
116
	public function __toString() {
117
		$xml = "";
118
119
		if ($this->wrapperfactory) {
120
			// A wrapper has been provided
121
			$wrapper = $this->wrapperfactory->getElementWrapper($this); // Get the wrapper for this element
122
123
			$xml = $wrapper->wrap($this); // Wrap this element (and subelements)
124
		} else {
125
			// Output begin tag
126
			$generated = date("r");
127
			$xml .= "<odd version=\"{$this->ODDSupportedVersion}\" generated=\"$generated\">\n";
128
129
			// Get XML for elements
130
			foreach ($this->elements as $element) {
131
				$xml .= "$element";
132
			}
133
134
			// Output end tag
135
			$xml .= "</odd>\n";
136
		}
137
138
		return $xml;
139
	}
140
141
	// ITERATOR INTERFACE //////////////////////////////////////////////////////////////
142
	/*
143
	 * This lets an entity's attributes be displayed using foreach as a normal array.
144
	 * Example: http://www.sitepoint.com/print/php5-standard-library
145
	 */
146
147
	private $valid = false;
148
149
	/**
150
	 * Iterator interface
151
	 *
152
	 * @see Iterator::rewind()
153
	 *
154
	 * @return void
155
	 */
156
	function rewind() {
157
		$this->valid = (false !== reset($this->elements));
158
	}
159
160
	/**
161
	 * Iterator interface
162
	 *
163
	 * @see Iterator::current()
164
	 *
165
	 * @return void
166
	 */
167
	function current() {
168
		return current($this->elements);
169
	}
170
171
	/**
172
	 * Iterator interface
173
	 *
174
	 * @see Iterator::key()
175
	 *
176
	 * @return void
177
	 */
178
	function key() {
179
		return key($this->elements);
180
	}
181
182
	/**
183
	 * Iterator interface
184
	 *
185
	 * @see Iterator::next()
186
	 *
187
	 * @return void
188
	 */
189
	function next() {
190
		$this->valid = (false !== next($this->elements));
191
	}
192
193
	/**
194
	 * Iterator interface
195
	 *
196
	 * @see Iterator::valid()
197
	 *
198
	 * @return void
199
	 */
200
	function valid() {
201
		return $this->valid;
202
	}
203
}
204