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.

templates/permission/update-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
5
namespace App\Http\Requests\{{ $modelWithNamespaceFromDefault }};
6
@php
7
    $standardColumns = $columns->reject(function($column) use ($relatable) {
8
        return in_array($column['name'], $relatable->pluck('name')->toArray())|| $column["name"]=='slug';
9
    });
10
    $relatableColumns = $columns->filter(function($column) use ($relatable) {
11
        return in_array($column['name'], $relatable->pluck('name')->toArray());
12
    })->keyBy('name');
13
@endphp
14
15
@if($containsPublishedAtColumn)
16
use Carbon\Carbon;
17
@endif
18
19
use Illuminate\Foundation\Http\FormRequest;
20
use Illuminate\Support\Facades\Gate;
21
use Illuminate\Validation\Rule;
22
23
class Update{{ $modelBaseName }} extends FormRequest
24
{
25
    /**
26
     * Determine if the user is authorized to make this request.
27
     *
28
     * {{'@'}}return bool
29
     */
30
    public function authorize(): bool
31
    {
32
        return $this->user()->can('update', $this->{{ $modelVariableName }});
33
    }
34
35
    /**
36
     * Get the validation rules that apply to the request.
37
     *
38
     * {{'@'}}return array
39
     */
40
    public function rules(): array
41
    {
42
        return [
43
            @foreach($standardColumns as $column)
44
@if(!($column['name'] == "updated_by_admin_user_id" || $column['name'] == "created_by_admin_user_id" ))'{{ $column['name'] }}' => [{!! implode(', ', (array) $column['serverUpdateRules']) !!}],
45
@endif
46
            @endforeach
47
@if (count($relations))
48
    @if (isset($relations['belongsToMany']) && count($relations['belongsToMany']))
49
50
            @foreach($relations['belongsToMany'] as $belongsToMany)'{{ $belongsToMany['related_table'] }}' => [{!! implode(', ', ['\'sometimes\'', '\'array\'']) !!}],
51
            @endforeach
52
    @endif
53
    @if (isset($relations["belongsTo"]) && count($relations['belongsTo']))
54
55
        @foreach($relations['belongsTo'] as $belongsTo)
56
    '{{ $belongsTo['relationship_variable'] }}' => [{!! implode(', ', array_merge(
57
    ['\'array\''], collect($relatableColumns[$belongsTo['foreign_key']]['serverUpdateRules'])->reject(function($rule){return str_contains($rule,'integer');})->toArray()
58
    )) !!}],
59
        @endforeach
60
    @endif
61
@endif
62
@if($containsPublishedAtColumn)'publish_now' => ['nullable', 'boolean'],
63
            'unpublish_now' => ['nullable', 'boolean'],
64
@endif
65
66
        ];
67
    }
68
69
    /**
70
     * Modify input data
71
     *
72
     * {{'@'}}return array
73
     */
74
    public function sanitizedArray(): array
75
    {
76
        $sanitized = $this->validated();
77
78
@if($containsPublishedAtColumn)
79
        if (isset($sanitized['publish_now']) && $sanitized['publish_now'] === true) {
80
            $sanitized['published_at'] = Carbon::now();
81
        }
82
83
        if (isset($sanitized['unpublish_now']) && $sanitized['unpublish_now'] === true) {
84
            $sanitized['published_at'] = null;
85
        }
86
@endif
87
88
        //Add your code for manipulation with request data here
89
90
        return $sanitized;
91
    }
92
    /**
93
    * Return modified (sanitized data) as a php object
94
    * @return object
95
    */
96
    public function sanitizedObject(): object {
97
        $sanitized = $this->sanitizedArray();
98
        return json_decode(collect($sanitized));
99
    }
100
}
101