Issues (162)

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.

tests/AcachaAdminLTELaravelTest.php (8 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
use App\User;
4
use Chrisbjr\ApiGuard\Models\ApiKey;
5
use Illuminate\Foundation\Testing\DatabaseMigrations;
6
use Illuminate\Support\Facades\Hash;
7
8
/**
9
 * Class AcachaAdminLTELaravelTest.
10
 */
11
class AcachaAdminLTELaravelTest extends TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
{
13
    use DatabaseMigrations;
14
15
    /**
16
     * @param User $user
17
     *
18
     * @return mixed
19
     */
20
    private function createUserApiKey(User $user)
21
    {
22
        $apiKey = ApiKey::make($user->id);
23
        $apiKey->save();
24
    }
25
26
    /**
27
     * Test Landing Page.
28
     *
29
     * @return void
30
     */
31
    public function testLandingPage()
32
    {
33
        //        $this->visit('/')
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
34
//             ->see('Acacha')
35
//             ->see('adminlte-laravel')
36
//             ->see('Pratt');
37
    }
38
39
    /**
40
     * Test Landing Page.
41
     *
42
     * @return void
43
     */
44
    public function testLandingPageWithUserLogged()
45
    {
46
        //        $user = factory(App\User::class)->create();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
47
//
48
//        $this->actingAs($user)
49
//            ->visit('/')
50
//            ->see('Acacha')
51
//            ->see('adminlte-laravel')
52
//            ->see('Pratt')
53
//            ->see($user->name);
54
    }
55
56
    /**
57
     * Test Login Page.
58
     *
59
     * @return void
60
     */
61
    public function testLoginPage()
62
    {
63
        $this->visit('/login')
64
            ->see('Sign in to start your session');
65
    }
66
67
    /**
68
     * Test Login.
69
     *
70
     * @return void
71
     */
72
    public function testLogin()
73
    {
74
        $user = factory(App\User::class)->create(['password' => Hash::make('passw0RD')]);
75
        $this->createUserApiKey($user);
0 ignored issues
show
$user is of type object<Illuminate\Databa...se\Eloquent\Collection>, but the function expects a object<App\User>.

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...
76
77
        $this->visit('/login')
78
            ->type($user->email, 'email')
79
            ->type('passw0RD', 'password')
80
            ->press('Sign In')
81
            ->seePageIs('/upload')
82
            ->see($user->name);
83
    }
84
85
    /**
86
     * Test Login.
87
     *
88
     * @return void
89
     */
90
    public function testLoginRequiredFields()
91
    {
92
        $this->visit('/login')
93
            ->press('Sign In')
94
            ->see('The email field is required')
95
            ->see('The password field is required');
96
    }
97
98
    /**
99
     * Test Register Page.
100
     *
101
     * @return void
102
     */
103
    public function testRegisterPage()
104
    {
105
        $this->visit('/register')
106
            ->see('Register a new membership');
107
    }
108
109
    /**
110
     * Test Password reset Page.
111
     *
112
     * @return void
113
     */
114
    public function testPasswordResetPage()
115
    {
116
        $this->visit('/password/reset')
117
            ->see('Reset Password');
118
    }
119
120
    /**
121
     * Test home page is only for authorized Users.
122
     *
123
     * @return void
124
     */
125
    public function testHomePageForUnauthenticatedUsers()
126
    {
127
        $this->visit('/upload')
128
            ->seePageIs('/login');
129
    }
130
131
    /**
132
     * Test home page works with Authenticated Users.
133
     *
134
     * @return void
135
     */
136
    public function testHomePageForAuthenticatedUsers()
137
    {
138
        $user = factory(App\User::class)->create();
139
        $this->createUserApiKey($user);
0 ignored issues
show
$user is of type object<Illuminate\Databa...se\Eloquent\Collection>, but the function expects a object<App\User>.

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...
140
141
        $this->actingAs($user)
0 ignored issues
show
$user is of type object<Illuminate\Databa...se\Eloquent\Collection>, but the function expects a object<Illuminate\Contracts\Auth\Authenticatable>.

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...
142
            ->visit('/upload')
143
            ->see($user->name);
144
    }
145
146
    /**
147
     * Test log out.
148
     *
149
     * @return void
150
     */
151
    public function testLogout()
152
    {
153
        $user = factory(App\User::class)->create();
154
155
        $this->actingAs($user)
0 ignored issues
show
$user is of type object<Illuminate\Databa...se\Eloquent\Collection>, but the function expects a object<Illuminate\Contracts\Auth\Authenticatable>.

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...
156
            ->visit('/logout')
157
            ->seePageIs('/');
158
    }
159
160
    /**
161
     * Test 404 Error page.
162
     *
163
     * @return void
164
     */
165
    public function test404Page()
166
    {
167
        $this->get('asdasdjlapmnnk')
168
            ->seeStatusCode(404)
169
            ->see('404');
170
    }
171
172
    /**
173
     * Test user registration.
174
     *
175
     * @return void
176
     */
177
    public function testNewUserRegistration()
178
    {
179
        $this->visit('/register')
180
            ->type('Sergi Tur Badenas', 'name')
181
            ->type('[email protected]', 'email')
182
//            ->check('terms') TODO
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
183
            ->type('passw0RD', 'password')
184
            ->type('passw0RD', 'password_confirmation')
185
            ->press('Register')
186
            ->seePageIs('/upload')
187
            ->seeInDatabase('users', ['email' => '[email protected]',
188
                                      'name'  => 'Sergi Tur Badenas', ]);
189
    }
190
191
    /**
192
     * Test required fields on registration page.
193
     *
194
     * @return void
195
     */
196
    public function testRequiredFieldsOnRegistrationPage()
197
    {
198
        $this->visit('/register')
199
            ->press('Register')
200
            ->see('The name field is required')
201
            ->see('The email field is required')
202
            ->see('The password field is required');
203
    }
204
205
    /**
206
     * Test send password reset.
207
     *
208
     * @return void
209
     */
210
    public function testSendPasswordReset()
211
    {
212
        $user = factory(App\User::class)->create(['email' => '[email protected]']);
213
214
        $this->visit('password/reset')
215
            ->type($user->email, 'email')
216
            ->press('Send Password Reset Link')
217
            ->see('We have e-mailed your password reset link!');
218
    }
219
220
    /**
221
     * Test send password reset user not exists.
222
     *
223
     * @return void
224
     */
225
    public function testSendPasswordResetUserNotExists()
226
    {
227
        $this->visit('password/reset')
228
            ->type('[email protected]', 'email')
229
            ->press('Send Password Reset Link')
230
            ->see('There were some problems with your input');
231
    }
232
}
233