Issues (273)

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.

models/Permission.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
 * This file contains functionality relating to permissions that roles have
4
 *
5
 * @package    BZiON\Models
6
 * @license    https://github.com/allejo/bzion/blob/master/LICENSE.md GNU General Public License Version 3
7
 */
8
9
/**
10
 * A permission that is assigned to a role
11
 * @package    BZiON\Models
12
 */
13
class Permission extends Model
14
{
15
    const ADD_BAN            = "add_ban";
16
    const ADD_MAP            = "add_map";
17
    const ADD_SERVER         = "add_server";
18
    const CREATE_NEWS        = "add_news";
19
    const CREATE_PAGE        = "add_page";
20
    const CREATE_ROLE        = "add_role";
21
    const CREATE_TEAM        = "add_team";
22
    const CREATE_USER        = "add_user";
23
    const EDIT_BAN           = "edit_ban";
24
    const EDIT_MAP           = "edit_map";
25
    const EDIT_MATCH         = "edit_match";
26
    const EDIT_NEWS          = "edit_news";
27
    const EDIT_PAGE          = "edit_page";
28
    const EDIT_ROLE          = "edit_role";
29
    const EDIT_SERVER        = "edit_server";
30
    const EDIT_TEAM          = "edit_team";
31
    const EDIT_USER          = "edit_user";
32
    const ENTER_MATCH        = "add_match";
33
    const HARD_DELETE_BAN    = "wipe_ban";
34
    const HARD_DELETE_MAP    = "wipe_map";
35
    const HARD_DELETE_MATCH  = "wipe_match";
36
    const HARD_DELETE_NEWS   = "wipe_news";
37
    const HARD_DELETE_PAGE   = "wipe_page";
38
    const HARD_DELETE_ROLE   = "wipe_role";
39
    const HARD_DELETE_SERVER = "wipe_server";
40
    const HARD_DELETE_TEAM   = "wipe_team";
41
    const HARD_DELETE_USER   = "wipe_user";
42
    const PUBLISH_NEWS       = "publish_news";
43
    const PUBLISH_PAGE       = "publish_page";
44
    const SEND_PRIVATE_MSG   = "send_pm";
45
    const SOFT_DELETE_BAN    = "del_ban";
46
    const SOFT_DELETE_MATCH  = "del_match";
47
    const SOFT_DELETE_MAP    = "del_map";
48
    const SOFT_DELETE_NEWS   = "del_news";
49
    const SOFT_DELETE_PAGE   = "del_page";
50
    const SOFT_DELETE_ROLE   = "del_role";
51
    const SOFT_DELETE_SERVER = "del_server";
52
    const SOFT_DELETE_TEAM   = "del_team";
53
    const SOFT_DELETE_USER   = "del_user";
54
    const VIEW_SERVER_LIST   = "view_server_list";
55
    const VIEW_VISITOR_LOG   = "view_visitor_log";
56
    const BYPASS_MAINTENANCE = "bypass_maintenance";
57
58
    /**
59
     * The name of the permission
60
     * @var string
61
     */
62
    protected $name;
63
64
    /**
65
     * The description of the permission
66
     * @var string
67
     */
68
    protected $description;
69
70
    /**
71
     * The name of the database table used for queries
72
     */
73
    const TABLE = "permissions";
74
75
    /**
76
     * {@inheritdoc}
77
     */
78 1
    protected function assignResult($permission)
79
    {
80 1
        $this->name        = $permission['name'];
81 1
        $this->description = $permission['description'];
82 1
    }
83
84
    /**
85
     * Get the description of the permission
86
     * @return string The description of the permission
87
     */
88
    public function getDescription()
89
    {
90
        return $this->description;
91
    }
92
93
    /**
94
     * Get the name of the permission
95
     * @return string The name of the permission
96
     */
97
    public function getName()
98
    {
99
        return $this->name;
100
    }
101
102
    /**
103
     * Get all of the existing permissions in the database
104
     * @return Permission[] An array of permissions
105
     */
106
    public static function getPerms()
107
    {
108
        return parent::arrayIdToModel(
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (arrayIdToModel() instead of getPerms()). Are you sure this is correct? If so, you might want to change this to $this->arrayIdToModel().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
109
            self::fetchIds()
110
        );
111
    }
112
113
    /**
114
     * @param string|Permission $perm_name
115
     * @return Permission
116
     */
117 1
    public static function getPermissionFromName($perm_name)
118
    {
119 1
        if ($perm_name instanceof self) {
120
            return $perm_name;
121
        }
122
123 1
        return self::get(
124 1
            self::fetchIdFrom($perm_name, "name")
125
        );
126
    }
127
128
    public static function getQueryBuilder()
129
    {
130
        return new QueryBuilder("Permission", array(
131
            'columns' => array(
132
                'name' => 'name'
133
            ),
134
            'name' => 'name'
135
        ));
136
    }
137
}
138