Issues (111)

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.

classes/locallib/mobileview.php (3 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
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
17
/**
18
 * The mod_bigbluebuttonbn locallib/mobileview.
19
 *
20
 * @package   mod_bigbluebuttonbn
21
 * @copyright 2018 onwards, Blindside Networks Inc
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
25
namespace mod_bigbluebuttonbn\locallib;
26
27
defined('MOODLE_INTERNAL') || die();
28
global $CFG;
29
require_once($CFG->dirroot . '/mod/bigbluebuttonbn/locallib.php');
30
31
/**
32
 * Methods used to render view BBB in mobile.
33
 *
34
 * @copyright 2018 onwards, Blindside Networks Inc
35
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
37
class mobileview {
38
39
    /**
40
     * Build url for join to session.
41
     * This method is similar to "join_meeting()" in bbb_view.
42
     * @param array $bbbsession
43
     * @return string
44
     */
45
    public static function build_url_join_session(&$bbbsession) {
46
        $password = $bbbsession['viewerPW'];
47
        if ($bbbsession['administrator'] || $bbbsession['moderator']) {
48
            $password = $bbbsession['modPW'];
49
        }
50
        $joinurl = bigbluebuttonbn_get_join_url($bbbsession['meetingid'], $bbbsession['username'],
51
            $password, $bbbsession['logoutURL'], null, $bbbsession['userID'], $bbbsession['clienttype']);
52
53
        return($joinurl);
54
    }
55
56
    /**
57
     * Return the status of an activity [open|not_started|ended].
58
     *
59
     * @param array $bbbsession
60
     * @return string
61
     */
62 View Code Duplication
    public static function get_activity_status(&$bbbsession) {
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...
63
        $now = time();
64
        if (!empty($bbbsession['bigbluebuttonbn']->openingtime) && $now < $bbbsession['bigbluebuttonbn']->openingtime) {
65
            // The activity has not been opened.
66
            return 'not_started';
67
        }
68
        if (!empty($bbbsession['bigbluebuttonbn']->closingtime) && $now > $bbbsession['bigbluebuttonbn']->closingtime) {
69
            // The activity has been closed.
70
            return 'ended';
71
        }
72
        // The activity is open.
73
        return 'open';
74
    }
75
76
    /**
77
     * Helper for preparing metadata used while creating the meeting.
78
     *
79
     * @param  array    $bbbsession
80
     * @return array
81
     */
82
    public static function create_meeting_metadata(&$bbbsession) {
83
        return bigbluebuttonbn_create_meeting_metadata($bbbsession);
84
    }
85
86
    /**
87
     * Helper to prepare data used for create meeting.
88
     * @param array $bbbsession
89
     * @return array
90
     * @throws \coding_exception
91
     */
92
    public static function create_meeting_data(&$bbbsession) {
93
        $data = ['meetingID' => $bbbsession['meetingid'],
94
            'name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),
95
            'attendeePW' => $bbbsession['viewerPW'],
96
            'moderatorPW' => $bbbsession['modPW'],
97
            'logoutURL' => $bbbsession['logoutURL'],
98
        ];
99
        $data['record'] = self::create_meeting_data_record($bbbsession['record']);
100
        // Check if auto_start_record is enable.
101 View Code Duplication
        if ($data['record'] == 'true' && $bbbsession['recordallfromstart']) {
0 ignored issues
show
This code seems to be duplicated across 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...
102
            $data['autoStartRecording'] = 'true';
103
            // Check if hide_record_button is enable.
104
            if ($bbbsession['recordallfromstart'] && $bbbsession['recordhidebutton']) {
105
                $data['allowStartStopRecording'] = 'false';
106
            }
107
        }
108
        $data['welcome'] = trim($bbbsession['welcome']);
109
        // Set the duration for the meeting.
110
        $durationtime = self::create_meeting_data_duration($bbbsession['bigbluebuttonbn']->closingtime);
111 View Code Duplication
        if ($durationtime > 0) {
0 ignored issues
show
This code seems to be duplicated across 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...
112
            $data['duration'] = $durationtime;
113
            $data['welcome'] .= '<br><br>';
114
            $data['welcome'] .= str_replace(
115
                '%duration%',
116
                (string) $durationtime,
117
                get_string('bbbdurationwarning', 'bigbluebuttonbn')
118
            );
119
        }
120
        $voicebridge = intval($bbbsession['voicebridge']);
121
        if ($voicebridge > 0 && $voicebridge < 79999) {
122
            $data['voiceBridge'] = $voicebridge;
123
        }
124
        $maxparticipants = intval($bbbsession['userlimit']);
125
        if ($maxparticipants > 0) {
126
            $data['maxParticipants'] = $maxparticipants;
127
        }
128
        if ($bbbsession['muteonstart']) {
129
            $data['muteOnStart'] = 'true';
130
        }
131
        return $data;
132
    }
133
134
    /**
135
     * Helper for returning the flag to know if the meeting is recorded.
136
     *
137
     * @param  boolean    $record
138
     * @return string
139
     */
140
    public static function create_meeting_data_record($record) {
141
        if ((boolean)\mod_bigbluebuttonbn\locallib\config::recordings_enabled() && $record) {
142
            return 'true';
143
        }
144
        return 'false';
145
    }
146
147
    /**
148
     * Helper for returning the duration expected for the meeting.
149
     *
150
     * @param  string    $closingtime
151
     * @return integer
152
     */
153
    public static function create_meeting_data_duration($closingtime) {
154
        if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('scheduled_duration_enabled')) {
155
            return bigbluebuttonbn_get_duration($closingtime);
156
        }
157
        return 0;
158
    }
159
}
160