Issues (1751)

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/modules/mod_cache.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
	class cache {
3 12
		public function __construct($cache_config) {
4 12
			debug("cache([array])","store");
5
			// init cache store
6 12
			$inst_store = $cache_config["dbms"]."store";
7 12
			include_once($cache_config["code"]."stores/$inst_store.phtml");
8 12
			$this->cachestore=new $inst_store($cache_config["root"], $cache_config);
0 ignored issues
show
The property cachestore does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
9 12
		}
10
11
		public function save($filename, $objectChain, $templateChain) {
12
			if (!is_array($objectChain)) {
13
				return false;
14
			}
15
			if (!is_array($templateChain)) {
16
				return false;
17
			}
18
			if ( !$this->cachestore->exists('/') ) {
19
				$this->cachestore->save( '/', 'pobject', new baseObject );
20
			}
21
22
			$data = new baseObject;
23
			$data->filename = $filename;
0 ignored issues
show
The property filename does not seem to exist in baseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
24
			$data->objectChain = $objectChain;
0 ignored issues
show
The property objectChain does not seem to exist in baseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
25
			$data->templateChain = $templateChain;
0 ignored issues
show
The property templateChain does not seem to exist in baseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
26
27
                        $properties = array();
28
			$properties["objectref"] = array();
29
			$properties["template"] = array();
30
31
			foreach ($objectChain as $id => $value) {
32
				$properties["objectref"][] = array("name" => "id", "value" => $id);
33
			}
34
			foreach ($templateChain as $id => $template) {
35
				foreach ($template as $name => $value) {
36
					foreach ($value as $type => $dummy) {
37
						$properties["template"][] = array("name" => "name", "value" => $id . ":" . $type . ":" . $name);
38
					}
39
				}
40
			}
41
42
			$this->cachestore->save("/" . md5($filename) . "/", "pcache", $data, $properties);
43
44
			// $onsave = $this->onTemplateSaved("1944", "ppage", "ppage.view.div1.html.any");
45
		}
46
47 6 View Code Duplication
		public function onTemplateSaved($id, $type, $name) {
48 6
			$query = "template.value='$id:$type:$name' order by none";
49 6
			$objects = $this->cachestore->find("/", $query, 0, 0);
50
51
			$template = function($object) {
52
				return $object->data->filename;
53 6
			};
54
55 6
			$result = $this->cachestore->call($template,array(),$objects);
56 6
			$result = array_unique($result);
57
58 6
			foreach ($result as $filename) {
59
				$this->invalidate($filename);
60 6
			}
61 6
		}
62
63 12 View Code Duplication
		public function onObjectSaved($id) {
64 12
			$query = "objectref.value='$id' order by none";
65 12
			$objects = $this->cachestore->find("/", $query, 0, 0);
66
67 12
			$template = function($object) {
68
				return $object->data->filename;
69 12
			};
70
71 12
			$result = $this->cachestore->call($template,array(),$objects);
72 12
			$result = array_unique($result);
73
74 12
			foreach ($result as $filename) {
75
				$this->invalidate($filename);
76 12
			}
77 12
		}
78
79 12
		public function invalidate($filename) {
80 12
			global $store;
81
			$absFilename = $store->get_config("files")."cache/".$filename;
82
			$stamp = time();
83
84
			if (file_exists($absFilename)) {
85
				if (filemtime($absFilename) > $stamp + 2) {  // do not touch file which will expire soon
86
					touch($absFilename, $stamp + 1); // set mtime to now; this means the cache image is now invalid;
87
				}
88
			}
89
		}
90
91
		public function delete($filename) {
92
			$this->cachestore->delete("/" . md5($filename) . "/");
93
		}
94
	}
95
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
96