Issues (5)

Security Analysis    no request data  

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/Support/Guardian.php (1 issue)

Severity

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
namespace EmilMoe\Guardian\Support;
4
5
use Illuminate\Support\Facades\Auth;
6
7
/**
8
 * Class Guardian
9
 * @package EmilMoe\Guardian\Guardian\Support
10
 */
11
class Guardian
12
{
13
    /**
14
     * @return mixed
15
     */
16
    public static function getUserTable()
17
    {
18
        return with(self::_getUser())->getTable();
19
    }
20
21
    /**
22
     * @return mixed
23
     */
24
    public static function getUserKey()
25
    {
26
        return with(self::_getUser())->getKeyName();
27
    }
28
29
    /**
30
     * @return bool
31
     */
32
    public static function hasClients()
33
    {
34
        return config('guardian.client') != null;
35
    }
36
37
    /**
38
     * @return mixed
39
     */
40
    public static function getClientTable()
41
    {
42
        return self::_getClient()->getTable();
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48
    public static function getClientKey()
49
    {
50
        return self::_getClient()->getKeyName();
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public static function getClientColumn()
57
    {
58
        return self::getClientTable() .'_'. self::getClientKey();
59
    }
60
61
    /**
62
     * @return mixed
63
     */
64
    public static function getClientId()
65
    {
66
        return Auth::user()->{config('guardian.client.relation')};
67
68
        foreach (config('guardian.client') as $step)
0 ignored issues
show
foreach (config('guardia...ser = $user->{$step}; } does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
69
            $user = $user->{$step};
70
71
        return $user;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public static function getRolesPermissionsTable()
78
    {
79
        return config('guardian.table.role') .'_'. config('guardian.table.permission');
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public static function getUsersRolesTable()
86
    {
87
        return self::getUserTable() .'_'. config('guardian.table.role');
88
    }
89
90
    /**
91
     * @return mixed
92
     */
93
    public static function getUserClass()
94
    {
95
        return config('guardian.user.model');
96
    }
97
98
    /**
99
     * @return mixed
100
     */
101
    public static function getPermissionTable()
102
    {
103
        return config('guardian.table.permission');
104
    }
105
106
    /**
107
     * @return mixed
108
     */
109
    public static function getClientClass()
110
    {
111
        return config('guardian.client.model');
112
    }
113
114
    /**
115
     * @return mixed
116
     */
117
    private static function _getUser()
118
    {
119
        $user = self::getUserClass();
120
        return new $user;
121
    }
122
123
    /**
124
     * @return mixed
125
     */
126
    private static function _getClient()
127
    {
128
        $client = self::getClientClass();
129
        return new $client;
130
    }
131
}