GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (31)

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/Services/CrudValidator.php (4 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
namespace Akibatech\Crud\Services;
4
5
use Akibatech\Crud\Exceptions\FailedValidationException;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\Facades\Validator;
8
use Symfony\Component\HttpFoundation\RedirectResponse;
9
10
/**
11
 * Class CrudValidator
12
 *
13
 * @package Akibatech\Crud\Services
14
 */
15
class CrudValidator
16
{
17
    /**
18
     * @var CrudEntry
19
     */
20
    protected $entry;
21
22
    /**
23
     * @var Validator
24
     */
25
    protected $validator;
26
27
    /**
28
     * @var array
29
     */
30
    protected $form_data;
31
32
    /**
33
     * CrudValidator constructor.
34
     *
35
     * @param   void
36
     */
37
    public function __construct(CrudEntry $entry)
38
    {
39
        $this->setEntry($entry);
40
    }
41
42
    /**
43
     * Defines the CrudEntry to validate.
44
     *
45
     * @param   CrudEntry $entry
46
     * @return  self
47
     */
48
    public function setEntry(CrudEntry $entry)
49
    {
50
        $this->entry = $entry;
51
52
        return $this;
53
    }
54
55
    /**
56
     * Gets the entry.
57
     *
58
     * @param   void
59
     * @return  CrudEntry
60
     */
61
    public function getEntry()
62
    {
63
        return $this->entry;
64
    }
65
66
    /**
67
     * @param   array $data
68
     * @return  self
69
     */
70
    public function setFormData(array $data)
71
    {
72
        $this->form_data = $data;
73
74
        return $this;
75
    }
76
77
    /**
78
     * @param   Request $request
79
     * @return  self
80
     */
81
    public function validateRequest(Request $request)
82
    {
83
        return $this->validate($request->only($this->getEntry()->getFields()->keys()));
84
    }
85
86
    /**
87
     * Validate given array of data against fields rules.
88
     *
89
     * @param   array $fields_data
90
     * @return  self
91
     */
92
    public function validate(array $fields_data)
93
    {
94
        $rules = $this->getEntry()->getFields()->validationRules();
95
        $this->setFormData($fields_data);
96
97
        $this->validator = Validator::make($fields_data, $rules);
98
        $this->validator = $this->getEntry()->getFields()->contextualValidationRules($this->validator);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getEntry()->getFi...Rules($this->validator) of type object<Illuminate\Validation\Validator> is incompatible with the declared type object<Illuminate\Support\Facades\Validator> of property $validator.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
99
        $this->validator->fails();
100
101
        return $this;
102
    }
103
104
    /**
105
     * @param   void
106
     * @return  bool
107
     */
108
    public function fails()
109
    {
110
        return count($this->validator->failed()) === 0 ? false : true;
0 ignored issues
show
The method failed() does not seem to exist on object<Illuminate\Support\Facades\Validator>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
111
    }
112
113
    /**
114
     * @param   void
115
     * @return  bool
116
     */
117
    public function passes()
118
    {
119
        return $this->validator->fails() === false;
0 ignored issues
show
The method fails() does not seem to exist on object<Illuminate\Support\Facades\Validator>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
120
    }
121
122
    /**
123
     * @param   void
124
     * @return  RedirectResponse
125
     */
126
    public function redirect()
127
    {
128
        if ($this->fails())
129
        {
130
            return redirect()->back()->withInput()->withErrors($this->validator);
131
        }
132
133
        return redirect($this->entry->getManager()->getActionRoute('index'));
134
    }
135
136
    /**
137
     * @param   void
138
     * @return  bool
139
     * @throws  FailedValidationException
140
     */
141
    public function save()
142
    {
143
        if ($this->fails())
144
        {
145
            throw new FailedValidationException("Entry has failed its validation and can't be saved.");
146
        }
147
148
        $this->entry->getFields()->hydrateFormData($this->form_data);
149
150
        return $this->entry->save();
151
    }
152
153
    /**
154
     * @param   void
155
     * @return  self
156
     */
157
    protected function resetValidator()
158
    {
159
        $this->validator = null;
160
        $this->form_data = null;
0 ignored issues
show
Documentation Bug introduced by
It seems like null of type null is incompatible with the declared type array of property $form_data.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
161
        $this->getEntry()->resetValidator();
162
163
        return $this;
164
    }
165
166
    /**
167
     * @param   void
168
     * @return  Validator
169
     */
170
    public function getValidator()
171
    {
172
        return $this->validator;
173
    }
174
}
175