Issues (81)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

services/template/loader.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\services\template;
11
12
/**
13
 * Class template_loader
14
 *
15
 * @package blitze\content\services
16
 */
17
class loader implements \Twig_LoaderInterface
18
{
19
	/* @var array */
20
	protected $blocks_data = array();
21
22
	/* @var array */
23
	protected $content_types = array();
24
25
	/**
26
	 * Constructor
27
	 *
28
	 * @param \blitze\content\services\types				$content			Content types object
29
	 * @param \blitze\sitemaker\model\mapper_factory		$mapper_factory		Mapper factory object
30
	 */
31
	public function __construct(\blitze\content\services\types $content, \blitze\sitemaker\model\mapper_factory $mapper_factory)
0 ignored issues
show
The type blitze\sitemaker\model\mapper_factory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
	{
33
		$types = $content->get_all_types();
34
		foreach ($types as $type => $entity)
35
		{
36
			/** @var \blitze\content\model\entity\type $entity */
37
			$this->content_types[$type] = array(
38
				'summary_tpl'	=> $entity->get_summary_tpl(),
39
				'detail_tpl'	=> $entity->get_detail_tpl(),
40
				'last_modified'	=> $entity->get_last_modified(),
41
			);
42
		}
43
44
		$block_mapper = $mapper_factory->create('blocks');
45
		$collection = $block_mapper->find(array('name', '=', 'blitze.content.block.recent'));
46
47
		foreach ($collection as $entity)
48
		{
49
			/** @var \blitze\sitemaker\model\entity\block $entity */
50
			$settings = $entity->get_settings();
51
			$this->blocks_data[$entity->get_bid()] = array(
52
				'block_tpl'		=> htmlspecialchars_decode($settings['block_tpl']),
53
				'last_modified'	=> $settings['last_modified'],
54
			);
55
		}
56
	}
57
58
	public function setPaths()
59
	{
60
		// do nothing
61
	}
62
63
	/**
64
	 * @param string $name
65
	 * @return mixed
66
	 * @throws \Twig_Error_Loader
67
	 */
68
	public function getSource($name)
69
	{
70
		if (false === $source = $this->getValue('source', $name))
71
		{
72
			throw new \Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name));
73
		}
74
75
		return $source;
76
	}
77
78
	/**
79
	 * Twig_SourceContextLoaderInterface as of Twig 1.27
80
	 * @param string $name
81
	 * @return mixed
82
	 * @throws \Twig_Error_Loader
83
	 */
84
	public function getSourceContext($name)
85
	{
86
		if (false === $source = $this->getValue('source', $name))
87
		{
88
			throw new \Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name));
89
		}
90
91
		return new \Twig_Source($source, $name);
92
	}
93
94
	/**
95
	 * Twig_ExistsLoaderInterface as of Twig 1.11
96
	 * @param string $name
97
	 * @return bool
98
	 */
99
	public function exists($name)
100
	{
101
		return $name === $this->getValue('name', $name);
102
	}
103
104
	/**
105
	 * @param string $name
106
	 * @return string
107
	 */
108
	public function getCacheKey($name)
109
	{
110
		return $name;
111
	}
112
113
	/**
114
	 * @param string $name
115
	 * @param int $time
116
	 * @return bool
117
	 */
118
	public function isFresh($name, $time)
119
	{
120
		if (false === $last_modified = $this->getValue('last_modified', $name))
121
		{
122
			return false;
123
		}
124
125
		return $last_modified <= $time;
126
	}
127
128
	/**
129
	 * @param string $what
130
	 * @param string $name
131
	 * @return mixed
132
	 */
133
	protected function getValue($what, $name)
134
	{
135
		preg_match('/(.*)_(summary|detail|block)$/is', $name, $match);
136
		list(, $id, $view) = $match;
137
138
		$data = ($view === 'block') ? $this->blocks_data[$id] : $this->content_types[$id];
139
140
		$return = array(
141
			'name'			=> $name,
142
			'source'		=> $data[$view . '_tpl'],
143
			'last_modified'	=> $data['last_modified'],
144
		);
145
146
		return $return[$what];
147
	}
148
}
149