Issues (258)

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.

Authentication/UI/API/Controllers/Controller.php (1 issue)

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 App\Containers\Authentication\UI\API\Controllers;
4
5
use Apiato\Core\Foundation\Facades\Apiato;
6
use App\Containers\Authentication\Data\Transporters\ProxyApiLoginTransporter;
7
use App\Containers\Authentication\Data\Transporters\ProxyRefreshTransporter;
8
use App\Containers\Authentication\UI\API\Requests\LoginRequest;
9
use App\Containers\Authentication\UI\API\Requests\LogoutRequest;
10
use App\Containers\Authentication\UI\API\Requests\RefreshRequest;
11
use App\Ship\Parents\Controllers\ApiController;
12
use App\Ship\Transporters\DataTransporter;
13
use Illuminate\Support\Facades\Config;
14
use Illuminate\Support\Facades\Cookie;
15
16
/**
17
 * Class Controller
18
 *
19
 * @author  Mahmoud Zalt  <[email protected]>
20
 */
21
class Controller extends ApiController
22
{
23
24
    /**
25
     * @param \App\Containers\Authentication\UI\API\Requests\LogoutRequest $request
26
     *
27
     * @return \Illuminate\Http\JsonResponse
28
     */
29
    public function logout(LogoutRequest $request)
30
    {
31
        $dataTransporter = new DataTransporter($request);
32
        $dataTransporter->bearerToken = $request->bearerToken();
33
34
        Apiato::call('[email protected]', [$dataTransporter]);
35
36
        return $this->accepted([
37
            'message' => 'Token revoked successfully.',
38
        ])->withCookie(Cookie::forget('refreshToken'));
39
    }
40
41
    /**
42
     * This `proxyLoginForAdminWebClient` exist only because we have `AdminWebClient`
43
     * The more clients (Web Apps). Each client you add in the future, must have
44
     * similar functions here, with custom route for dedicated for each client
45
     * to be used as proxy when contacting the OAuth server.
46
     * This is only to help the Web Apps (JavaScript clients) hide
47
     * their ID's and Secrets when contacting the OAuth server and obtain Tokens.
48
     *
49
     * @param \App\Containers\Authentication\UI\API\Requests\LoginRequest $request
50
     *
51
     * @return \Illuminate\Http\JsonResponse
52
     */
53
    public function proxyLoginForAdminWebClient(LoginRequest $request)
54
    {
55
        $dataTransporter = new ProxyApiLoginTransporter(
56
            array_merge($request->all(), [
57
                'client_id'       => Config::get('authentication-container.clients.web.admin.id'),
58
                'client_password' => Config::get('authentication-container.clients.web.admin.secret')
59
            ])
60
        );
61
62
        $result = Apiato::call('[email protected]', [$dataTransporter]);
63
64
        return $this->json($result['response_content'])->withCookie($result['refresh_cookie']);
65
    }
66
67
    /**
68
     * Read the comment in the function `proxyLoginForAdminWebClient`
69
     *
70
     * @param \App\Containers\Authentication\UI\API\Requests\RefreshRequest $request
71
     *
72
     * @return \Illuminate\Http\JsonResponse
73
     */
74
    public function proxyRefreshForAdminWebClient(RefreshRequest $request)
75
    {
76
        $dataTransporter = new ProxyRefreshTransporter(
77
            array_merge($request->all(), [
78
                'client_id'       => Config::get('authentication-container.clients.web.admin.id'),
79
                'client_password' => Config::get('authentication-container.clients.web.admin.secret'),
80
                // use the refresh token sent in request data, if not exist try to get it from the cookie
81
                'refresh_token'   => $request->refresh_token ? : $request->cookie('refreshToken'),
0 ignored issues
show
The property refresh_token does not exist on object<App\Containers\Au...equests\RefreshRequest>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
82
            ])
83
        );
84
85
        $result = Apiato::call('[email protected]', [$dataTransporter]);
86
87
        return $this->json($result['response-content'])->withCookie($result['refresh-cookie']);
88
    }
89
}
90