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/Services/InitMeeting.php (6 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
3
namespace JoisarJignesh\Bigbluebutton\Services;
4
5
use BigBlueButton\Parameters\CreateMeetingParameters;
6
use BigBlueButton\Parameters\EndMeetingParameters;
7
use BigBlueButton\Parameters\GetMeetingInfoParameters;
8
use BigBlueButton\Parameters\IsMeetingRunningParameters;
9
use BigBlueButton\Parameters\JoinMeetingParameters;
10
use Illuminate\Support\Str;
11
12
trait InitMeeting
13
{
14
    /**
15
     * @param array $parameters
16
     *
17
     * required fields
18
     * meetingID
19
     * meetingName
20
     * optional fields
21
     * moderatorPW
22
     * attendeePW
23
     *
24
     * @return CreateMeetingParameters
25
     */
26
    public function initCreateMeeting(array $parameters)
27
    {
28
        $request = Fluent($parameters);
29
        $meetingParams = new CreateMeetingParameters($request->meetingID, $request->meetingName);
30
        $meetingParams->setModeratorPassword($request->get('moderatorPW', Str::random(config('bigbluebutton.create.passwordLength', 8))));
31
        $meetingParams->setAttendeePassword($request->get('attendeePW', Str::random(config('bigbluebutton.create.passwordLength', 8))));
32
        $meetingParams->setDuration($request->get('duration', config('bigbluebutton.create.duration', 0)));
33
        $meetingParams->setRecord($request->get('record', config('bigbluebutton.create.record', false)));
34
        $meetingParams->setMaxParticipants($request->get('maxParticipants', config('bigbluebutton.create.maxParticipants', 0)));
35
        $meetingParams->setLogoutUrl($request->get('logoutUrl', config('bigbluebutton.create.logoutUrl', null)));
36
        $meetingParams->setWelcomeMessage(
37
            $request->get('welcomeMessage', config('bigbluebutton.create.welcomeMessage', null))
38
        );
39
        $meetingParams->setDialNumber(
40
            $request->get('dialNumber', config('bigbluebutton.create.dialNumber', null))
41
        );
42
        $meetingParams->setBreakout(
43
            $request->get('isBreakout', config('bigbluebutton.create.isBreakout', false))
44
        );
45
        $meetingParams->setModeratorOnlyMessage(
46
            $request->get('moderatorOnlyMessage', config('bigbluebutton.create.moderatorOnlyMessage', null))
47
        );
48
        $meetingParams->setAutoStartRecording(
49
            $request->get('autoStartRecording', config('bigbluebutton.create.autoStartRecording', false))
50
        );
51
        $meetingParams->setAllowStartStopRecording(
52
            $request->get('allowStartStopRecording', config('bigbluebutton.create.allowStartStopRecording', true))
53
        );
54
        $meetingParams->setWebcamsOnlyForModerator(
55
            $request->get('webcamsOnlyForModerator', config('bigbluebutton.create.webcamsOnlyForModerator', false))
56
        );
57
        $meetingParams->setLogo(
58
            $request->get('logo', config('bigbluebutton.create.logo', null))
59
        );
60
        $meetingParams->setCopyright(
61
            $request->get('copyright', config('bigbluebutton.create.copyright', null))
62
        );
63
        $meetingParams->setMuteOnStart(
64
            $request->get('muteOnStart', config('bigbluebutton.create.muteOnStart', false))
65
        );
66
67
        $meetingParams->setLockSettingsDisableCam(
68
            $request->get('lockSettingsDisableCam', config('bigbluebutton.create.lockSettingsDisableCam', false))
69
        );
70
        $meetingParams->setLockSettingsDisableMic(
71
            $request->get('lockSettingsDisableMic', config('bigbluebutton.create.lockSettingsDisableMic', false))
72
        );
73
        $meetingParams->setLockSettingsDisablePrivateChat(
74
            $request->get('lockSettingsDisablePrivateChat', config('bigbluebutton.create.lockSettingsDisablePrivateChat', false))
75
        );
76
        $meetingParams->setLockSettingsDisablePublicChat(
77
            $request->get('lockSettingsDisablePublicChat', config('bigbluebutton.create.lockSettingsDisablePublicChat', false))
78
        );
79
        $meetingParams->setLockSettingsDisableNote(
80
            $request->get('lockSettingsDisableNote', config('bigbluebutton.create.lockSettingsDisableNote', false))
81
        );
82
        $meetingParams->setLockSettingsLockedLayout(
83
            $request->get('lockSettingsLockedLayout', config('bigbluebutton.create.lockSettingsLockedLayout', false))
84
        );
85
        $meetingParams->setLockSettingsLockOnJoin(
86
            $request->get('lockSettingsLockOnJoin', config('bigbluebutton.create.lockSettingsLockOnJoin', false))
87
        );
88
        $meetingParams->setLockSettingsLockOnJoinConfigurable(
89
            $request->get('lockSettingsLockOnJoinConfigurable', config('bigbluebutton.create.lockSettingsLockOnJoinConfigurable', false))
90
        );
91
92
        if (! is_null($request->get('endCallbackUrl', null))) {
93
            $meetingParams->setEndCallbackUrl($request->get('endCallbackUrl', null));
94
        }
95
96
        if (! is_null($request->get('bbb-recording-ready-url', null))) {
97
            $meetingParams->setRecordingReadyCallbackUrl($request->get('bbb-recording-ready-url', null));
98
        }
99
100
        $meetingParams->setFreeJoin($request->get('freeJoin', false));
101
102
        $presentation = (array) $request->get('presentation', null);
103
        foreach ($presentation as $item) {
104
            if (isset($item['fileName']) && ! empty($item['fileName'])) {
105
                if (isset($item['link']) && ! empty($item['link'])) {
106
                    $meetingParams->addPresentation(trim($item['link']), null, trim($item['fileName']));
107
                } elseif (isset($item['content']) && ! empty($item['content'])) {
108
                    $meetingParams->addPresentation(trim($item['fileName']), trim($item['content']), null);
109
                }
110
            }
111
        }
112
113
        $meta = (array) $request->get('meta', null);
114
        foreach ($meta as $key => $value) {
115
            $meetingParams->addMeta(trim($key), trim($value));
116
        }
117
118
        return $meetingParams;
119
    }
120
121
    /**
122
     * @param array $parameters
123
     *
124
     * required fields:
125
     * meetingID
126
     * moderatorPW close meeting must be there moderator password
127
     *
128
     * @return EndMeetingParameters
129
     */
130
    public function initCloseMeeting(array $parameters)
131
    {
132
        $request = Fluent($parameters);
133
134
        return new EndMeetingParameters($request->meetingID, $request->moderatorPW);
135
    }
136
137
    /**
138
     * @param array $parameters
139
     *
140
     *  required fields
141
     *
142
     *  meetingID
143
     *  userName join by name
144
     *  password which role want to join
145
     *
146
     * @return JoinMeetingParameters
147
     */
148
    public function initJoinMeeting(array $parameters)
149
    {
150
        $request = Fluent($parameters);
151
        $meetingParams = new JoinMeetingParameters($request->meetingID, $request->userName, $request->password);
152
        $meetingParams->setRedirect($request->get('redirect', config('bigbluebutton.join.redirect', true)));
153
        $meetingParams->setJoinViaHtml5($request->get('joinViaHtml5', config('bigbluebutton.join.joinViaHtml5', true)));
154
        $meetingParams->setUserId($request->get('userId', null));
155
        if ($request->createTime) {
156
            $meetingParams->setCreationTime($request->createTime);
157
        }
158
        if ($request->configToken) {
159
            $meetingParams->setConfigToken($request->configToken);
160
        }
161
        if ($request->webVoiceConf) {
162
            $meetingParams->setWebVoiceConf($request->webVoiceConf);
163
        }
164
        if ($request->avatarUrl) {
165
            $meetingParams->setAvatarURL($request->avatarUrl);
166
        }
167
        if ($request->clientUrl) {
168
            $meetingParams->setClientURL($request->clientUrl);
169
        }
170
        if ($request->customParameters && is_array($request->customParameters)) {
171
            foreach ($request->customParameters as $key => $value) {
172
                $meetingParams->setCustomParameter($key, $value);
173
            }
174
        }
175
176
        return $meetingParams;
177
    }
178
179
    /**
180
     * @param $parameters
181
     *
182
     * required fields
183
     * meetingID
184
     *
185
     * @return IsMeetingRunningParameters
186
     */
187
    public function initIsMeetingRunning($parameters)
188
    {
189
        $meetingID = '';
0 ignored issues
show
$meetingID is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
190
        if (is_array($parameters)) {
191
            $meetingID = Fluent($parameters)->get('meetingID');
192
        } else {
193
            $meetingID = $parameters;
194
        }
195
196
        return new IsMeetingRunningParameters($meetingID);
197
    }
198
199
    /**
200
     * @param $parameters
201
     *
202
     * required fields
203
     * meetingID
204
     * moderatorPW must be there moderator password
205
     *
206
     * @return GetMeetingInfoParameters
207
     */
208
    public function initGetMeetingInfo($parameters)
209
    {
210
        $request = Fluent($parameters);
211
212
        return new GetMeetingInfoParameters($request->meetingID, $request->moderatorPW);
213
    }
214
215
    private function makeJoinMeetingArray($object, $parameters)
216
    {
217
        $pass['meetingID'] = $object->get('meetingID');
0 ignored issues
show
Coding Style Comprehensibility introduced by
$pass was never initialized. Although not strictly required by PHP, it is generally a good practice to add $pass = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
218
        $pass['password'] = $object->get('moderatorPW');
219
        if (isset($parameters['userName'])) {
220
            $pass['userName'] = $parameters['userName'];
221
        }
222
        $pass['meetingName'] = $object->get('meetingName');
223
        if (isset($parameters['redirect'])) {
224
            $pass['redirect'] = $parameters['redirect'];
225
        }
226
227
        return $pass;
228
    }
229
230
    /**
231
     * @param array $parameters
232
     *
233
     * required fields
234
     * meetingID
235
     * meetingName
236
     * userName
237
     * attendeePW
238
     * moderatorPW
239
     *
240
     * @return mixed
241
     */
242
    public function initStart(array $parameters)
243
    {
244
        if ($this->getMeetingInfo($parameters)->isEmpty()) {
0 ignored issues
show
The method getMeetingInfo() does not exist on JoisarJignesh\Bigbluebutton\Services\InitMeeting. Did you maybe mean initGetMeetingInfo()?

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...
245
            $object = $this->create($parameters);
0 ignored issues
show
The method create() does not exist on JoisarJignesh\Bigbluebutton\Services\InitMeeting. Did you maybe mean initCreateMeeting()?

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...
246
            if (method_exists($object, 'isEmpty') && ! $object->isEmpty()) {
247
                return $this->join($this->makeJoinMeetingArray($object, $parameters));
0 ignored issues
show
It seems like join() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
248
            }
249
        } else {
250
            if (isset($parameters['moderatorPW'])) {
251
                $parameters['password'] = trim($parameters['moderatorPW']);
252
            }
253
254
            return $this->join($parameters);
0 ignored issues
show
It seems like join() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
255
        }
256
    }
257
}
258