Issues (140)

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.

views/templates/permission/store-request.blade.php (2 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 echo "<?php"
0 ignored issues
show
Security Best Practice introduced by
It is not recommend to use PHP's short opening tag <?, better use <?php, or <?= in case of outputting.

Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.

As a precaution to avoid these problems better use the long opening tag <?php.

Loading history...
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected '"'
Loading history...
2
@endphp
3
4
namespace App\Http\Requests\{{ $modelWithNamespaceFromDefault }};
5
@php
6
    $standardColumns = $columns->reject(function($column) use ($relatable) {
7
        return in_array($column['name'], $relatable->pluck('name')->toArray())|| $column["name"]=='slug';
8
    });
9
    $relatableColumns = $columns->filter(function($column) use ($relatable) {
10
        return in_array($column['name'], $relatable->pluck('name')->toArray());
11
    })->keyBy('name');
12
@endphp
13
14
use Illuminate\Foundation\Http\FormRequest;
15
use Illuminate\Support\Facades\Gate;
16
use Illuminate\Validation\Rule;
17
use {{$modelFullName}};
18
class Store{{ $modelBaseName }} extends FormRequest
19
{
20
    /**
21
     * Determine if the user is authorized to make this request.
22
     *
23
     * {{'@'}}return bool
24
     */
25
    public function authorize(): bool
26
    {
27
        return $this->user()->can('create',{{$modelBaseName}}::class);
28
    }
29
30
    /**
31
     * Get the validation rules that apply to the request.
32
     *
33
     * {{'@'}}return array
34
     */
35
    public function rules(): array
36
    {
37
        return [
38
            @foreach($standardColumns as $column)
39
@if(!($column['name'] == "updated_by_admin_user_id" || $column['name'] == "created_by_admin_user_id" ))'{{ $column['name'] }}' => [{!! implode(', ', (array) $column['serverStoreRules']) !!}],
40
@endif
41
            @endforeach
42
@if (count($relations))
43
    @if (isset($relations["belongsToMany"]) && count($relations['belongsToMany']))
44
45
            @foreach($relations['belongsToMany'] as $belongsToMany)'{{ $belongsToMany['related_table'] }}' => [{!! implode(', ', ['\'array\'']) !!}],
46
            @endforeach
47
    @endif
48
    @if (isset($relations["belongsTo"]) && count($relations['belongsTo']))
49
50
            @foreach($relations['belongsTo'] as $belongsTo)
51
'{{ $belongsTo['relationship_variable'] }}' => [{!! implode(', ', array_merge(
52
    ['\'array\''], collect($relatableColumns[$belongsTo['foreign_key']]['serverStoreRules'])->reject(function($rule){return str_contains($rule,'integer');})->toArray()
53
)) !!}],
54
            @endforeach
55
    @endif
56
@endif
57
58
        ];
59
    }
60
    /**
61
    * Modify input data
62
    *
63
    * {{'@'}}return array
64
    */
65
    public function sanitizedArray(): array
66
    {
67
        $sanitized = $this->validated();
68
69
        //Add your code for manipulation with request data here
70
71
        return $sanitized;
72
    }
73
    /**
74
    * Return modified (sanitized data) as a php object
75
    * @return object
76
    */
77
    public function sanitizedObject(): object {
78
        $sanitized = $this->sanitizedArray();
79
        return json_decode(collect($sanitized));
80
    }
81
}
82