Issues (40)

Security Analysis    no request data  

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/Actions/Read.php (2 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
namespace agoalofalife\bpm\Actions;
3
4
use agoalofalife\bpm\Assistants\AuthenticationHelper;
5
use agoalofalife\bpm\Assistants\ConstructorUrl;
6
use agoalofalife\bpm\Assistants\QueryBuilder;
7
use agoalofalife\bpm\Contracts\Action;
8
use agoalofalife\bpm\Contracts\ActionGet;
9
use agoalofalife\bpm\Contracts\Handler;
10
use agoalofalife\bpm\KernelBpm;
11
use Assert\Assert;
12
13
14
/**
15
 * Class Read
16
 * @property KernelBpm $kernel
17
 * @property string $HTTP_TYPE GET | POST | PUT | DELETE
18
 * @property string $url
19
 * @uses     ConstructorUrl trait
20
 * @package agoalofalife\bpm\Actions
21
 */
22
class Read implements Action, ActionGet
23
{
24
    use ConstructorUrl, QueryBuilder, AuthenticationHelper;
25
26
    protected $kernel;
27
28
    /**
29
     * Type HTTP_TYPE select
30
     * @var string
31
     */
32
    protected $HTTP_TYPE = 'GET';
33
34
    protected $url = '?';
35
36
    /**
37
     * @param KernelBpm $bpm
38
     * @return  void
39
     */
40 1
    public function injectionKernel(KernelBpm $bpm)
41
    {
42 1
        $this->kernel = $bpm;
43 1
    }
44
45
    /**
46
     * @return string url
47
     */
48 8
    public function getUrl()
49
    {
50 8
        return $this->url;
51
    }
52
53
    /**
54
     * @return Handler
55
     */
56 1
    public function processData()
57
    {
58 1
        $this->getData();
59 1
        return $this->kernel->getHandler();
60
    }
61
62 1
    public function getData()
63
    {
64 1
        $this->query();
65 1
    }
66
67
    /**
68
     * Request the type of filter
69
     * Design   filterConstructor allows you to build logical expressions the conditions selecting the desired object .
70
     * Expressions filterConstructor can be used to reference the properties and literals ,
71
     * as well as strings, numbers and Boolean expressions (true, false).
72
     * Expressions $ filter supports arithmetic , logical operations , and operations groups ,
73
     * strings , date and time of the operation.
74
     * @documentation
75
     * @param $strRequest
76
     * @return $this
77
     */
78 2
    public function filterConstructor($strRequest)
79
    {
80 2
        $ParameterQuery =  '$filter=';
81 2
        $ParameterQuery.=  $strRequest;
82 2
        $this->concatenationUrlCurl($ParameterQuery);
83 2
        return $this;
84
    }
85
86
    /**
87
     * Service resources can be obtained in the form of sort .
88
     * asc  ascending
89
     * desc descending
90
     * @param string $whatSort
91
     * @param string $param  asc | desc
92
     * @return $this
93
     * @throws \Exception
94
     */
95 2
    public function orderBy($whatSort, $param = 'asc')
96
    {
97 2
        $ParameterQuery = '$orderby=';
98 2
        $ParameterQuery.=  ucfirst($whatSort);
99
100 2
        if ( empty($param) === false ) {
101 2
            if ($param != 'desc' && $param != 'asc') {
102 1
                throw new \Exception('no valid orderby parameters');
103
            }
104 1
            $ParameterQuery.=  " ".$param;
105 1
        }
106 1
         $this->concatenationUrlCurl($ParameterQuery);
107
108 1
        return $this;
109
    }
110
111
    /**
112
     * In bpm'online support the use of parameter $ the skip ,
113
     * which allows you to query the service resources ,
114
     * skipping the specified number of entries.
115
     * @param $skip
116
     * @return $this
117
     */
118 2
    public function skip($skip)
119
    {
120 2
        Assert::that($skip, 'You must specify a numeric parameter for the amount of the method')->integer();
121 1
        $ParameterQuery = '$skip='.$skip;
122 1
        $this->concatenationUrlCurl($ParameterQuery);
123
124 1
        return $this;
125
    }
126
127
    /**
128
     * Restrictions in the sample query
129
     * If you want the request to return more than 40 records at a time, it can be implemented using the parameter $ top
130
     * @param $amountMax
131
     * @return $this
132
     */
133 2
    public function amount($amountMax = null)
134
    {
135 2
        Assert::that($amountMax,'You must specify a numeric parameter for the amount of the method')->integer();
136 1
        $ParameterQuery = '$top='.$amountMax;
137 1
        $this->concatenationUrlCurl($ParameterQuery);
138 1
        return $this;
139
    }
140
141
    /**
142
     * The number of records
143
     * example SomeCollection/$count or SomeCollection/$count?$filter=...
144
     * @return $this
145
     */
146 1
    public function count()
147
    {
148 1
        $this->url = '/';
149 1
        $ParameterQuery = '$count';
150 1
        $this->concatenationUrlCurl($ParameterQuery);
151 1
        return $this;
152
    }
153
154
    /**
155
     * TODO Requires refactoring of this method
156
     * @return void
157
     */
158 1 View Code Duplication
    private function query()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
159
    {
160 1
        $parameters   = str_replace(' ', '%20', $this->url);
161 1
        $url          = $this->kernel->getCollection() . $parameters;
162 1
        $urlHome      = config($this->kernel->getPrefixConfig() . '.UrlHome');
163
164 1
        $response     =  $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url,
165 1
                         $this->debug()->headers()->getCookie()->httpErrorsFalse()->get()
166 1
        );
167 1
        $body         = $response->getBody();
168
169 1
        $this->kernel->getHandler()->parse($body->getContents());
0 ignored issues
show
The method parse() does not seem to exist on object<Illuminate\Container\Container>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
170
171 1
        $this->checkResponseUnauthorized($response);
172
    }
173
}