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/PluginInclude.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
 * 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 Modified BSD License
12
 * @version   1.3.2
13
 * @date      2017-01-06
14
 * @link      http://dwoo.org/
15
 */
16
17
namespace Dwoo\Plugins\Functions;
18
19
use Dwoo\Exception as Exception;
20
use Dwoo\Plugin;
21
use Dwoo\Security\Exception as SecurityException;
22
23
/**
24
 * Inserts another template into the current one
25
 * <pre>
26
 *  * file : the resource name of the template
27
 *  * cache_time : cache length in seconds
28
 *  * cache_id : cache identifier for the included template
29
 *  * compile_id : compilation identifier for the included template
30
 *  * data : data to feed into the included template, it can be any array and will default to $_root (the current data)
31
 *  * assign : if set, the output of the included template will be saved in this variable instead of being output
32
 *  * rest : any additional parameter/value provided will be added to the data array
33
 * </pre>
34
 * This software is provided 'as-is', without any express or implied warranty.
35
 * In no event will the authors be held liable for any damages arising from the use of this software.
36
 */
37
class PluginInclude extends Plugin
38
{
39
    /**
40
     * @param        $file
41
     * @param null   $cache_time
42
     * @param null   $cache_id
43
     * @param null   $compile_id
44
     * @param string $data
45
     * @param null   $assign
46
     * @param array  $rest
47
     *
48
     * @return string
49
     */
50
    public function process($file, $cache_time = null, $cache_id = null, $compile_id = null, $data = '_root', $assign = null, array $rest = array())
51
    {
52
        $include = null;
53
        if ($file === '') {
54
            return '';
55
        }
56
57 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...
58
            // resource:identifier given, extract them
59
            $resource   = $m[1];
60
            $identifier = $m[2];
61
        } else {
62
            // get the current template's resource
63
            $resource   = $this->core->getTemplate()->getResourceName();
64
            $identifier = $file;
65
        }
66
67
        try {
68
            $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
69
        }
70
        catch (SecurityException $e) {
71
            $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
72
        }
73
        catch (Exception $e) {
74
            $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
75
        }
76
77
        if ($include === null) {
78
            $this->core->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.',
79
                E_USER_WARNING);
80
        } elseif ($include === false) {
81
            $this->core->triggerError('Include : Resource "' . $resource . '" does not support includes.',
82
                E_USER_WARNING);
83
        }
84
85
        if (is_string($data)) {
86
            $vars = $this->core->readVar($data);
87
        } else {
88
            $vars = $data;
89
        }
90
91
        if (count($rest)) {
92
            $vars = $rest + $vars;
93
        }
94
95
        $clone = clone $this->core;
96
        $out   = $clone->get($include, $vars);
97
98
        if ($assign !== null) {
99
            $this->core->assignInScope($out, $assign);
100
        }
101
102
        foreach ($clone->getReturnValues() as $name => $value) {
103
            $this->core->assignInScope($value, $name);
104
        }
105
106
        if ($assign === null) {
107
            return $out;
108
        }
109
    }
110
}