Issues (19)

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/Http/Controllers/ProjectController.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 Larafolio\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Larafolio\Models\Project;
7
use Larafolio\Http\Requests\AddProjectRequest;
8
9
class ProjectController extends Controller
10
{
11
    /**
12
     * Return all projects.
13
     *
14
     * @return \Illuminate\Http\JsonResponse
15
     */
16
    public function index()
17
    {
18
        return response()->json(Project::all());
19
    }
20
21
    /**
22
     * Show an individual project in the manager.
23
     *
24
     * @param string $slug Slug of the project to show.
25
     *
26
     * @return \Illuminate\Http\Response
27
     */
28
    public function show($slug)
29
    {
30
        $project = Project::withBlocks($slug)->first();
31
32
        if (!$project) {
33
            abort(404, "No project with slug {$slug} found.");
34
        }
35
36
        $images = $project->imagesWithProps();
37
38
        return view('larafolio::projects.show', [
39
            'project' => $project,
40
            'images'  => $images,
41
        ]);
42
    }
43
44
    /**
45
     * Return the project create page.
46
     *
47
     * @return \Illuminate\Http\Response
48
     */
49
    public function create()
50
    {
51
        return view('larafolio::projects.add');
52
    }
53
54
    /**
55
     * Add a new project to the portfolio.
56
     *
57
     * @param AddProjectRequest $request Form request.
58
     *
59
     * @return \Illuminate\Http\Response
60
     */
61
    public function store(AddProjectRequest $request)
62
    {
63
        $project = $this->user->addProject($request->all());
64
65
        if ($request->ajax()) {
66
            return response()->json(['project' => $project]);
67
        }
68
69
        return redirect(route('show-project', ['project' => $project]));
70
    }
71
72
    /**
73
     * Return the project edit form view.
74
     *
75
     * @param string $slug Slug for the project to edit.
76
     *
77
     * @return \Illuminate\Http\Response
78
     */
79
    public function edit($slug)
80
    {
81
        $project = Project::full($slug)->first();
82
83
        $nextBlock = $project->blocks->pluck('order')->max() + 1;
84
85
        $nextLink = $project->links->pluck('order')->max() + 1;
86
87
        return view('larafolio::projects.edit', [
88
            'project'   => $project,
89
            'nextBlock' => $nextBlock,
90
            'nextLink'  => $nextLink,
91
        ]);
92
    }
93
94
    /**
95
     * Update a project.
96
     *
97
     * @param \Illuminate\Http\Request $request Request data.
98
     * @param string                   $slug    Slug of project to update.
99
     *
100
     * @return \Illuminate\Http\Response
101
     */
102
    public function update(Request $request, $slug)
103
    {
104
        $project = Project::withTrashed()->where('slug', $slug)->first();
105
106
        if ($project->trashed()) {
107
            $this->user->restoreProject($project);
108
        } else {
109
            $this->user->updateProject($project, $request->all());
110
        }
111
112
        if ($request->ajax()) {
113
            return response()->json(['project' => $project]);
114
        }
115
116
        return redirect(route('show-project', ['project' => $project]));
117
    }
118
119
    /**
120
     * Remove a project from the portfolio.
121
     *
122
     * @param \Illuminate\Http\Request $request Request data.
123
     * @param string                   $slug    Slug of project to remove.
124
     *
125
     * @return \Illuminate\Http\Response
126
     */
127
    public function destroy(Request $request, $slug)
128
    {
129
        $project = Project::withTrashed()->where('slug', $slug)->first();
130
131
        if ($project->trashed()) {
132
            $this->user->purgeProject($project);
133
        } else {
134
            $this->user->removeProject($project);
135
        }
136
137
        if ($request->ajax()) {
138
            return response()->json(true);
0 ignored issues
show
true is of type boolean, but the function expects a string|array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
139
        }
140
141
        return redirect(route('dashboard'));
142
    }
143
}
144