Issues (1131)

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.

src/config/RbacDefinitionConfigHandler.class.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
// +---------------------------------------------------------------------------+
4
// | This file is part of the Agavi package.                                   |
5
// | Copyright (c) 2005-2011 the Agavi Project.                                |
6
// | Based on the Mojavi3 MVC Framework, Copyright (c) 2003-2005 Sean Kerr.    |
7
// |                                                                           |
8
// | For the full copyright and license information, please view the LICENSE   |
9
// | file that was distributed with this source code. You can also view the    |
10
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
11
// |   vi: set noexpandtab:                                                    |
12
// |   Local Variables:                                                        |
13
// |   indent-tabs-mode: t                                                     |
14
// |   End:                                                                    |
15
// +---------------------------------------------------------------------------+
16
17
namespace Agavi\Config;
18
19
use Agavi\Config\Util\Dom\XmlConfigDomElement;
20
use Agavi\Config\XmlConfigHandler;
21
use Agavi\Config\Util\Dom\XmlConfigDomDocument;
22
23
/**
24
 * RbacDefinitionConfigHandler handles RBAC role and permission definition files
25
 *
26
 * @package    agavi
27
 * @subpackage config
28
 *
29
 * @author     David Zülke <[email protected]>
30
 * @copyright  Authors
31
 * @copyright  The Agavi Project
32
 *
33
 * @since      0.11.0
34
 *
35
 * @version    $Id$
36
 */
37
class RbacDefinitionConfigHandler extends XmlConfigHandler
38
{
39
    const XML_NAMESPACE = 'http://agavi.org/agavi/config/parts/rbac_definitions/1.1';
40
    
41
    /**
42
     * Execute this configuration handler.
43
     *
44
     * @param      XmlConfigDomDocument $document The document to parse.
45
     *
46
     * @return     string Data to be written to a cache file.
47
     *
48
     * @throws     <b>UnreadableException</b> If a requested configuration
49
     *                                        file does not exist or is not
50
     *                                        readable.
51
     * @throws     <b>ParseException</b> If a requested configuration file is
52
     *                                   improperly formatted.
53
     *
54
     * @author     David Zülke <[email protected]>
55
     * @since      0.11.0
56
     */
57 View Code Duplication
    public function execute(XmlConfigDomDocument $document)
0 ignored issues
show
This method seems to be duplicated in 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
    {
59
        // set up our default namespace
60
        $document->setDefaultNamespace(self::XML_NAMESPACE, 'rbac_definitions');
61
        
62
        $data = array();
63
64
        foreach ($document->getConfigurationElements() as $cfg) {
65
            if (!$cfg->has('roles')) {
66
                continue;
67
            }
68
            
69
            $this->parseRoles($cfg->get('roles'), null, $data);
70
        }
71
72
        $code = "return " . var_export($data, true) . ";";
73
        
74
        return $this->generate($code, $document->documentURI);
75
    }
76
    
77
    /**
78
     * Parse a 'roles' node.
79
     *
80
     * @param      mixed  $roles  The "roles" node (element or node list)
81
     * @param      string $parent The name of the parent role, or null.
82
     * @param      array  $data   A reference to the output data array.
83
     *
84
     * @author     David Zülke <[email protected]>
85
     * @since      0.11.0
86
     */
87
    protected function parseRoles($roles, $parent, &$data)
88
    {
89
        /** @var XmlConfigDomElement $role */
90
        foreach ($roles as $role) {
91
            $name = $role->getAttribute('name');
92
            $entry = array();
93
            $entry['parent'] = $parent;
94
            $entry['permissions'] = array();
95
            if ($role->has('permissions')) {
96
                /** @var XmlConfigDomElement $permission */
97
                foreach ($role->get('permissions') as $permission) {
98
                    $entry['permissions'][] = $permission->getValue();
99
                }
100
            }
101
            if ($role->has('roles')) {
102
                $this->parseRoles($role->get('roles'), $name, $data);
103
            }
104
            $data[$name] = $entry;
105
        }
106
    }
107
}
108