Issues (292)

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/Dwoo/Plugins/Functions/PluginLoadTemplates.php (3 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-2017
4
 *
5
 * @category  Library
6
 * @package   Dwoo\Plugins\Functions
7
 * @author    Jordi Boggiano <[email protected]>
8
 * @author    David Sanchez <[email protected]>
9
 * @copyright 2008-2013 Jordi Boggiano
10
 * @copyright 2013-2017 David Sanchez
11
 * @license   http://dwoo.org/LICENSE LGPLv3
12
 * @version   1.3.6
13
 * @date      2017-03-21
14
 * @link      http://dwoo.org/
15
 */
16
17
namespace Dwoo\Plugins\Functions;
18
19
use Dwoo\Compiler;
20
use Dwoo\Compilation\Exception as CompilationException;
21
use Dwoo\ICompilable;
22
use Dwoo\Plugin;
23
24
/**
25
 * Loads sub-templates contained in an external file
26
 * <pre>
27
 *  * file : the resource name of the file to load
28
 * </pre>
29
 * This software is provided 'as-is', without any express or implied warranty.
30
 * In no event will the authors be held liable for any damages arising from the use of this software.
31
 */
32
class PluginLoadTemplates extends Plugin implements ICompilable
33
{
34
    /**
35
     * @param Compiler $compiler
36
     * @param string   $file
37
     *
38
     * @return string
39
     * @throws CompilationException
40
     */
41
    public static function compile(Compiler $compiler, $file)
42
    {
43
        $file = substr($file, 1, - 1);
44
45
        if ($file === '') {
46
            return '';
47
        }
48
49 View Code Duplication
        if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
0 ignored issues
show
This code seems to be duplicated across 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...
50
            // resource:identifier given, extract them
51
            $resource   = $m[1];
52
            $identifier = $m[2];
53
        } else {
54
            // get the current template's resource
55
            $resource   = $compiler->getCore()->getTemplate()->getResourceName();
56
            $identifier = $file;
57
        }
58
59
        $tpl = $compiler->getCore()->templateFactory($resource, $identifier);
60
61 View Code Duplication
        if ($tpl === null) {
0 ignored issues
show
This code seems to be duplicated across 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...
62
            throw new CompilationException($compiler,
63
                'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
64
        } elseif ($tpl === false) {
65
            throw new CompilationException($compiler,
66
                'Load Templates : Resource "' . $resource . '" does not support includes.');
67
        }
68
69
        $cmp = clone $compiler;
70
        $cmp->compile($compiler->getCore(), $tpl);
71
        foreach ($cmp->getTemplatePlugins() as $template => $args) {
72
            $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']);
73
        }
74
        foreach ($cmp->getUsedPlugins() as $plugin => $type) {
75
            $compiler->addUsedPlugin($plugin, $type);
76
        }
77
78
        $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
79
80
        $modCheck = $tpl->getIsModifiedCode();
81
82 View Code Duplication
        if ($modCheck) {
0 ignored issues
show
This code seems to be duplicated across 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...
83
            $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
84
        } else {
85
            $out .= 'try {
86
	$tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '");
87
} catch (Dwoo\Exception $e) {
88
	$this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING);
89
}
90
if ($tpl === null)
91
	$this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING);
92
elseif ($tpl === false)
93
	$this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING);
94
if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }';
95
        }
96
97
        return $out;
98
    }
99
}