Issues (16)

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/Jobs/MessageServiceBaseJob.php (1 issue)

Labels
Severity

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 Alive2212\LaravelMessageService\Jobs;
4
5
use Alive2212\LaravelMessageService\AliveMessage;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Queue\SerializesModels;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Contracts\Queue\ShouldQueue;
10
use Illuminate\Foundation\Bus\Dispatchable;
11
12
class MessageServiceBaseJob implements ShouldQueue
13
{
14
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
15
16
    /**
17
     * @var array
18
     */
19
    protected $processParams;
20
21
    /**
22
     * @var array
23
     */
24
    protected $modelParams;
25
26
    /**
27
     * To user who receive message
28
     *
29
     * @var
30
     */
31
    protected $to;
32
33
    /**
34
     * From user who send message
35
     *
36
     * @var
37
     */
38
    protected $from;
39
40
    /**
41
     * Body of message
42
     *
43
     * @var
44
     */
45
    protected $body;
46
47
    /**
48
     * Visibility of message when user watch to message box
49
     *
50
     * @var
51
     */
52
    protected $invisible;
53
54
    /**
55
     * Id of process that call this event
56
     *
57
     * @var
58
     */
59
    protected $processId;
60
61
    /**
62
     * This Job will be fired by a precess
63
     * @param array $processParams
64
     * @param array $modelParams
65
     */
66
    public function __construct(array $processParams, array $modelParams)
67
    {
68
        $this->processParams = $processParams;
69
        $this->modelParams = $modelParams;
70
71
        $this->initValues($processParams, $modelParams);
72
73
        $this->storeMessage();
74
    }
75
76
    /**
77
     * Execute the job.
78
     *
79
     * @return void
80
     */
81
    public function handle()
82
    {
83
        //
84
    }
85
86
    /**
87
     * @param array $processParams
88
     * @param array $modelParam
89
     */
90
    public function initValues(array $processParams, array $modelParam)
91
    {
92
        // get process id
93
        $this->processId = $processParams['id'];
94
95
        // filling data
96
        $this->invisible = $processParams['invisible'];
97
98
        $processFrom = $processParams['from'];
99
        if (isset($modelParam[$processFrom])) {
100
            $this->from = $modelParam[$processFrom];
101
        }
102
103
        $processTo = $processParams['to'];
104
        if (isset($modelParam[$processTo])) {
105
            $this->to = $modelParam[$processTo];
106
        }
107
108
        $this->initBody($processParams, $modelParam);
109
    }
110
111
    /**
112
     * @param array $processParams
113
     * @param $modelParam
114
     */
115
    public function initBody(array $processParams, $modelParam)
116
    {
117
        $processBody = $processParams['body'];
118
        $processBodyParams = explode('{', $processBody);
119
        foreach ($processBodyParams as $processBodyParam) {
120
            $processBodyTag = explode('}', $processBodyParam);
121
            if (count($processBodyTag) > 1) {
122
                if (isset($modelParam[$processBodyTag[0]])) {
123
                    // TODO it should get related parameters
124
                    $this->body .= $modelParam[$processBodyTag[0]];
125
                }
126
                array_shift($processBodyTag);
127
            }
128
            $this->body .= $processBodyTag[0];
129
        }
130
    }
131
132
    /**
133
     * Store message into Alive Message table
134
     */
135
    public function storeMessage()
136
    {
137
        // store message to Alive Message model
138
        $message = new AliveMessage();
139
        $message->create([
0 ignored issues
show
The method create() does not exist on Alive2212\LaravelMessageService\AliveMessage. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
140
            'to' => $this->to == '' ? null : $this->to,
141
            'from' => $this->from,
142
            'body' => $this->body,
143
            'invisible' => $this->invisible,
144
            'process_id' => $this->processId,
145
        ]);
146
    }
147
148
}
149