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.

Ship/core/Abstracts/Transformers/Transformer.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 Apiato\Core\Abstracts\Transformers;
4
5
use Apiato\Core\Exceptions\CoreInternalErrorException;
6
use Apiato\Core\Exceptions\UnsupportedFractalIncludeException;
7
use Apiato\Core\Foundation\Facades\Apiato;
8
use ErrorException;
9
use Exception;
10
use Illuminate\Support\Facades\Config;
11
use League\Fractal\Scope;
12
use League\Fractal\TransformerAbstract as FractalTransformer;
13
14
/**
15
 * Class Transformer.
16
 *
17
 * @author  Mahmoud Zalt <[email protected]>
18
 */
19
abstract class Transformer extends FractalTransformer
20
{
21
22
    /**
23
     * @return  mixed
24
     */
25
    public function user()
26
    {
27
        return Apiato::call('[email protected]');
28
    }
29
30
    /**
31
     * @param $adminResponse
32
     * @param $clientResponse
33
     *
34
     * @return  array
35
     */
36
    public function ifAdmin($adminResponse, $clientResponse)
37
    {
38
        $user = $this->user();
39
40
        if (!is_null($user) && $user->hasAdminRole()) {
41
            return array_merge($clientResponse, $adminResponse);
42
        }
43
44
        return $clientResponse;
45
    }
46
47
    /**
48
     * @param mixed                       $data
49
     * @param callable|FractalTransformer $transformer
50
     * @param null                        $resourceKey
51
     *
52
     * @return \League\Fractal\Resource\Item
53
     */
54
    public function item($data, $transformer, $resourceKey = null)
55
    {
56
        // set a default resource key if none is set
57
        if (!$resourceKey && $data) {
58
            $resourceKey = $data->getResourceKey();
59
        }
60
61
        return parent::item($data, $transformer, $resourceKey);
62
    }
63
64
    /**
65
     * @param mixed                       $data
66
     * @param callable|FractalTransformer $transformer
67
     * @param null                        $resourceKey
68
     *
69
     * @return \League\Fractal\Resource\Collection
70
     */
71
    public function collection($data, $transformer, $resourceKey = null)
72
    {
73
        // set a default resource key if none is set
74
        if (!$resourceKey && $data->isNotEmpty()) {
75
            $resourceKey = (string) $data->modelKeys()[0];
76
        }
77
78
        return parent::collection($data, $transformer, $resourceKey);
79
    }
80
81
    /**
82
     * @param Scope  $scope
83
     * @param string $includeName
84
     * @param mixed  $data
85
     *
86
     * @return \League\Fractal\Resource\ResourceInterface
87
     * @throws CoreInternalErrorException
88
     * @throws UnsupportedFractalIncludeException
89
     */
90
    protected function callIncludeMethod(Scope $scope, $includeName, $data)
91
    {
92
        try {
93
            return parent::callIncludeMethod($scope, $includeName, $data);
94
        }
95
        catch (ErrorException $exception) {
0 ignored issues
show
The class ErrorException does not exist. Is this class maybe located in a folder that is not analyzed, or in a newer version of your dependencies than listed in your composer.lock/composer.json?
Loading history...
96
            if (Config::get('apiato.requests.force-valid-includes', true)) {
97
                throw new UnsupportedFractalIncludeException($exception->getMessage());
98
            }
99
        }
100
        catch (Exception $exception) {
101
            throw new CoreInternalErrorException($exception->getMessage());
102
        }
103
    }
104
105
}
106