Issues (4388)

Security Analysis    no vulnerabilities found

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.

src/Application.php (83 issues)

1
<?php
0 ignored issues
show
Filename "Application.php" doesn't match the expected filename "application.php"
Loading history...
The PHP open tag does not have a corresponding PHP close tag
Loading history...
This file is missing a doc comment.
Loading history...
Class found in ".php" file; use ".inc" extension instead
Loading history...
2
3
declare(strict_types=1);
4
5
/**
0 ignored issues
show
Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
Loading history...
Block comments must be started with /*
Loading history...
The file-level docblock must follow the opening PHP tag in the file header
Loading history...
6
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
7
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
0 ignored issues
show
Doc comment short description must be on a single line, further text should be a separate paragraph
Loading history...
8
 *
9
 * Licensed under The MIT License
10
 * For full copyright and license information, please see the LICENSE.txt
11
 * Redistributions of files must retain the above copyright notice.
12
 *
13
 * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
14
 * @link      https://cakephp.org CakePHP(tm) Project
0 ignored issues
show
Tag value indented incorrectly; expected 1 space but found 6
Loading history...
The tag in position 2 should be the @license tag
Loading history...
15
 * @since     3.3.0
0 ignored issues
show
Tag value indented incorrectly; expected 1 space but found 5
Loading history...
The tag in position 3 should be the @link tag
Loading history...
16
 * @license   https://opensource.org/licenses/mit-license.php MIT License
0 ignored issues
show
The tag in position 4 should be the @since tag
Loading history...
Tag value indented incorrectly; expected 1 space but found 3
Loading history...
17
 */
0 ignored issues
show
Missing @category tag in file comment
Loading history...
PHP version not specified
Loading history...
Missing @package tag in file comment
Loading history...
Missing @author tag in file comment
Loading history...
18
19
namespace App;
20
21
use Cake\Core\Configure;
22
use Cake\Core\Exception\MissingPluginException;
23
use Cake\Error\Middleware\ErrorHandlerMiddleware;
24
use Cake\Http\BaseApplication;
25
use Cake\Http\Middleware\BodyParserMiddleware;
26
use Cake\Http\Middleware\CsrfProtectionMiddleware;
27
use Cake\Http\MiddlewareQueue;
28
use Cake\Routing\Middleware\AssetMiddleware;
29
use Cake\Routing\Middleware\RoutingMiddleware;
30
use Authentication\AuthenticationService;
31
use Authentication\AuthenticationServiceInterface;
32
use Authentication\AuthenticationServiceProviderInterface;
33
use Authentication\Identifier\IdentifierInterface;
34
use Authentication\Middleware\AuthenticationMiddleware;
35
#use Cake\Http\MiddlewareQueue;
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...
Perl-style comments are not allowed; use "// Comment" instead
Loading history...
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
36
use Cake\Routing\Router;
37
use Psr\Http\Message\ServerRequestInterface;
38
39
/**
40
 * Application setup class.
41
 *
42
 * This defines the bootstrapping logic and middleware layers you
43
 * want to use in your application.
44
 */
0 ignored issues
show
Missing @author tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @category tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
45
class Application extends BaseApplication implements AuthenticationServiceProviderInterface {
0 ignored issues
show
Opening brace of a class must be on the line after the definition
Loading history...
46
47
    /**
48
     * Load all the application configuration and bootstrap logic.
49
     *
50
     * @return void
0 ignored issues
show
If there is no return value for a function, there must not be a @return tag.
Loading history...
51
     */
52 22
    public function bootstrap(): void {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
53
        // Call parent to load bootstrap from files.
54 22
        parent::bootstrap();
55
56 22
        if (PHP_SAPI === 'cli') {
57 22
            $this->bootstrapCli();
58
        }
59
60
        /*
61
         * Only try to load DebugKit in development mode
62
         * Debug Kit should not be installed on a production system
63
         */
0 ignored issues
show
Empty line required after block comment
Loading history...
64 21
        if (Configure::read('debug')) {
65 20
            $this->addPlugin('DebugKit');
66
        }
67
68
        // Load more plugins here
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
69 21
        $this->addPlugin('Authentication');
70 21
    }
71
72
    /**
73
     * Setup the middleware queue your application will use.
74
     *
75
     * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup.
0 ignored issues
show
Parameter comment must be on the next line
Loading history...
76
     * @return \Cake\Http\MiddlewareQueue The updated middleware queue.
0 ignored issues
show
Separate the @param and @return sections by a blank line.
Loading history...
77
     */
78 21
    public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
79
        $middlewareQueue
80
                // Catch any exceptions in the lower layers,
81
                // and make an error page/response
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
82 21
                ->add(new ErrorHandlerMiddleware(Configure::read('Error')))
0 ignored issues
show
Object operator not indented correctly; expected 10 spaces but found 16
Loading history...
Space found before object operator
Loading history...
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
83
84
                // Handle plugin/theme assets like CakePHP normally does.
85 21
                ->add(new AssetMiddleware([
0 ignored issues
show
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
Space found before object operator
Loading history...
86 21
                            'cacheTime' => Configure::read('Asset.cacheTime'),
0 ignored issues
show
Array key not indented correctly; expected 20 spaces but found 28
Loading history...
87
                        ]))
0 ignored issues
show
Array closing indentation error, expected 16 spaces but found 24
Loading history...
Array close brace not indented correctly; expected 16 spaces but found 24
Loading history...
88
89
                // Add routing middleware.
90
                // If you have a large number of routes connected, turning on routes
0 ignored issues
show
Line exceeds 80 characters; contains 84 characters
Loading history...
91
                // caching in production could improve performance. For that when
0 ignored issues
show
Line exceeds 80 characters; contains 81 characters
Loading history...
92
                // creating the middleware instance specify the cache config name by
0 ignored issues
show
Line exceeds 80 characters; contains 84 characters
Loading history...
93
                // using it's second constructor argument:
94
                // `new RoutingMiddleware($this, '_cake_routes_')`
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
95 21
                ->add(new RoutingMiddleware($this))
0 ignored issues
show
Space found before object operator
Loading history...
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
96
97
                // Parse various types of encoded request bodies so that they are
0 ignored issues
show
Line exceeds 80 characters; contains 81 characters
Loading history...
98
                // available as array through $request->getData()
99
                // https://book.cakephp.org/4/en/controllers/middleware.html#body-parser-middleware
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
100 21
                ->add(new BodyParserMiddleware())
0 ignored issues
show
Space found before object operator
Loading history...
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
101
102
                // Cross Site Request Forgery (CSRF) Protection Middleware
103
                // https://book.cakephp.org/4/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
104 21
                ->add(new CsrfProtectionMiddleware([
0 ignored issues
show
Space found before object operator
Loading history...
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
105 21
                            'httponly' => true,
0 ignored issues
show
Array key not indented correctly; expected 20 spaces but found 28
Loading history...
106
                        ]))
0 ignored issues
show
Array close brace not indented correctly; expected 16 spaces but found 24
Loading history...
Array closing indentation error, expected 16 spaces but found 24
Loading history...
107 21
                ->add(new AuthenticationMiddleware($this));
0 ignored issues
show
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
Space found before object operator
Loading history...
108
109 21
        return $middlewareQueue;
110
    }
111
112
    /**
113
     * Bootrapping for CLI application.
114
     *
115
     * That is when running commands.
116
     *
117
     * @return void
0 ignored issues
show
If there is no return value for a function, there must not be a @return tag.
Loading history...
118
     */
119 22
    protected function bootstrapCli(): void {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
120
        try {
121 22
            $this->addPlugin('Bake');
122 1
        } catch (MissingPluginException $e) {
0 ignored issues
show
Expected newline after closing brace
Loading history...
123
            // Do not halt if the plugin is missing
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
124
        }
125
126 21
        $this->addPlugin('Migrations');
127
128
        // Load more plugins here
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
129 21
    }
130
131
    /**
132
     * Returns a service provider instance.
133
     *
134
     * @param \Psr\Http\Message\ServerRequestInterface $request Request
0 ignored issues
show
Parameter comment must end with a full stop
Loading history...
Parameter comment must be on the next line
Loading history...
135
     * @return \Authentication\AuthenticationServiceInterface
0 ignored issues
show
Separate the @param and @return sections by a blank line.
Loading history...
136
     */
137 19
    public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
The method parameter $request is never used
Loading history...
138 19
        $service = new AuthenticationService();
139
140
        // Define where users should be redirected to when they are not authenticated
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
Line exceeds 80 characters; contains 85 characters
Loading history...
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
141 19
        $service->setConfig([
142 19
            'unauthenticatedRedirect' => Router::url([
143 19
                'prefix' => 'Admin',
144
                'plugin' => null,
145
                'controller' => 'Users',
146
                'action' => 'login',
147
            ]),
148 19
            'queryParam' => 'redirect',
149
        ]);
150
151
        $fields = [
152 19
            IdentifierInterface::CREDENTIAL_USERNAME => 'email',
153 19
            IdentifierInterface::CREDENTIAL_PASSWORD => 'password'
0 ignored issues
show
A comma should follow the last multiline array item. Found: 'password'
Loading history...
154
        ];
155
        // Load the authenticators. Session should be first.
156 19
        $service->loadAuthenticator('Authentication.Session');
157 19
        $service->loadAuthenticator('Authentication.Form', [
158 19
            'fields' => $fields,
159 19
            'loginUrl' => Router::url([
160 19
                'prefix' => 'Admin',
161
                'plugin' => null,
162
                'controller' => 'Users',
163
                'action' => 'login',
164
            ]),
165
        ]);
166
167
        // Load identifiers
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
Loading history...
168 19
        $service->loadIdentifier('Authentication.Password', compact('fields'));
169
170 19
        return $service;
171
    }
172
173
}
174