Issues (144)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

app/Http/Controllers/SiteController.php (8 issues)

1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use App\DataTables\SiteDataTable;
7
use App\Site;
8
9
class SiteController extends Controller
10
{
11
    /**
12
     * Create a new controller instance.
13
     */
14
    public function __construct()
15
    {
16
        $this->middleware('auth');
17
    }
18
    
19
    /**
20
     * Display a listing of the resource.
21
     *
22
     * @param  SiteDataTable   $dataTable
23
     * @return Response
0 ignored issues
show
The type App\Http\Controllers\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
24
     */
25
    public function index(SiteDataTable $dataTable)
26
    {
27
        $this->authorize('index', Site::class);
28
        
29
        return $dataTable->render('site.index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $dataTable->render('site.index') also could return the type Illuminate\View\View|callable which is incompatible with the documented return type App\Http\Controllers\Response.
Loading history...
30
    }
31
    
32
    /**
33
     * Show the form for creating a new resource.
34
     *
35
     * @return \Illuminate\Http\Response
36
     */
37
    public function create()
38
    {
39
        $this->authorize('create', Site::class);
40
        
41
        return view('site.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('site.create') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
42
    }
43
    
44
    /**
45
     * Store a newly created resource in storage.
46
     *
47
     * @param  \Illuminate\Http\Request  $request
48
     * @return \Illuminate\Http\RedirectResponse
49
     */
50 View Code Duplication
    public function store(Request $request)
51
    {
52
        $this->authorize('store', Site::class);
53
        
54
        $request->validate([
55
            'name' => 'required|min:2|max:190|name|unique:sites,name',
56
        ]);
57
        
58
        $site = Site::create([ 'name' => $request->name ]);
59
        
60
        return redirect()->route('site.show', $site->id)
0 ignored issues
show
$site->id of type integer is incompatible with the type array expected by parameter $parameters of Illuminate\Routing\Redirector::route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

60
        return redirect()->route('site.show', /** @scrutinizer ignore-type */ $site->id)
Loading history...
61
            ->with('success', 'Site created successfully');
62
    }
63
    
64
    /**
65
     * Display the specified resource.
66
     *
67
     * @param  string  $id
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function show($id)
71
    {
72
        $this->authorize('show', Site::class);
73
        
74
        $site = Site::findOrFail($id);
75
        $locations = $site->locations()->orderBy('name', 'ASC')->paginate(15);
76
    
77
        if (\Request::ajax())
78
            return response()->json(['site' => $site, 'locations' => $locations]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return response()->json(...ations' => $locations)) returns the type Illuminate\Http\JsonResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
79
        else
80
            return view('site.show', [ 'site' => $site, 'locations' => $locations ]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('site.show',...ations' => $locations)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
81
    }
82
    
83
    /**
84
     * Show the form for editing the specified resource.
85
     *
86
     * @param  string  $id
87
     * @return \Illuminate\Http\Response
88
     */
89
    public function edit($id)
90
    {
91
        $this->authorize('edit', Site::class);
92
        
93
        $site = Site::findOrFail($id);
94
        return view('site.edit', [ 'site' => $site ]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('site.edit', array('site' => $site)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
95
    }
96
    
97
    /**
98
     * Update the specified resource in storage.
99
     *
100
     * @param  \Illuminate\Http\Request  $request
101
     * @param  Site  $site
102
     * @return \Illuminate\Http\RedirectResponse
103
     */
104 View Code Duplication
    public function update(Request $request, Site $site)
105
    {
106
        $this->authorize('update', Site::class);
107
        
108
        $request->validate([
109
            'name' => 'required|min:2|max:190|name|unique:sites,name,'.$site->id,
110
        ]);
111
        
112
        $site->update([ 'name' => $request->name ]);
113
        
114
        return redirect()->route('site.show', $site->id)
0 ignored issues
show
$site->id of type integer is incompatible with the type array expected by parameter $parameters of Illuminate\Routing\Redirector::route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

114
        return redirect()->route('site.show', /** @scrutinizer ignore-type */ $site->id)
Loading history...
115
            ->with('success', 'Site updated successfully');
116
    }
117
    
118
    /**
119
     * Remove the specified resource from storage.
120
     *
121
     * @param  string  $id
122
     * @return \Illuminate\Http\RedirectResponse
123
     */
124
    public function destroy($id)
125
    {
126
        $this->authorize('destroy', Site::class);
127
        
128
        Site::findOrFail($id)->delete();
129
        return redirect()->route('site.index')
130
            ->with('success', 'Site deleted successfully');
131
    }
132
}
133