Issues (173)

Security Analysis    13 potential vulnerabilities

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting (3)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (6)
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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  Cross-Site Scripting (1)
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.
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.

web/lib/admin/Wizard.php (2 issues)

Labels
Severity
1
<?php
2
/*
3
 * *****************************************************************************
4
 * Contributions to this work were made on behalf of the GÉANT project, a 
5
 * project that has received funding from the European Union’s Framework 
6
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
7
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
8
 * 691567 (GN4-1) and No. 731122 (GN4-2).
9
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
10
 * of the copyright in all material which was developed by a member of the GÉANT
11
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
12
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
13
 * UK as a branch of GÉANT Vereniging.
14
 * 
15
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
16
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
17
 *
18
 * License: see the web/copyright.inc.php file in the file structure or
19
 *          <base_url>/copyright.php after deploying the software
20
 */
21
22
namespace web\lib\admin;
23
24
/**
25
 * This class contains methods for displaing "wizard" help information for 
26
 * novice admins. During the first setup the messages are showm in-line.
27
 * Later only help icons are displayed and corresponding hints are displayed
28
 * in an overlay window
29
 * 
30
 * @author Tomasz Wolniewicz <[email protected]>
31
 * @author Stefan Winter <[email protected]>
32
 */
33
34
class Wizard extends UIElements {
35
    private $helpMessage;
36
    public $wizardStyle;
37
    private $optionsHelp;
38
        
39
    /**
40
     * Prepare the messages for the current language and set the wizardStyle
41
     * true means we display inline, false - show icons to call help.
42
     * 
43
     * @param boolean $wizardStyle
44
     */
45
    public function __construct($wizardStyle) {
46
        parent::__construct();
47
        $this->wizardStyle = $wizardStyle;
48
    }
49
    
50
    /**
51
     * Depending on the wizardStyle setting either display help in a fixed window
52
     * or display the "i" icon pointing to the help text in a hidden window
53
     * The text itself is taken from the helppMessage object indexed bu the $ubject
54
     * 
55
     * @param string $subject
56
     * @param array $options
57
     * @return string the HTML content for the page
58
     * 
59
     */
60
    public function displayHelp($subject, $options = NULL) {
61
        if (!isset($this->helpMessage[$subject])) {
62
            return '';
63
        }
64
        if ($options !== NULL) {
65
            if (!isset($options['level'])) {
66
                return '';
67
            }
68
        }
69
        return $this->displayHelpElement($this->helpMessage[$subject]);
70
    }
71
72
    /**
73
     * Depending on the wizardStyle setting either display help in a fixed window
74
     * or display the "i" icon pointing to the help text in a hidden window
75
     * The text itself is taken from the $input string
76
     * 
77
     * @param string $input
78
     * @return string the HTML content for the page
79
     * 
80
     */
81
    public function displayHelpText($input) {
82
        return $this->displayHelpElement($input);
83
    }
84
    
85
    /**
86
     * Create the actual content for displayHelp and displayHelpText
87
     * 
88
     * @param string $input
89
     * @return string the HTML content
90
     */
91
    private function displayHelpElement($input) {
92
        $iconTitle = _("Click to open the help window");
93
        if ($this->wizardStyle) {
94
            $wizardClass = "wizard_visible";
95
            $content = "<div>";
96
        } else {
97
            $wizardClass = "wizard_hidden";
98
            $content = "<div style='min-height:28px'><img src='../resources/images/icons/Tabler/info-square-rounded-filled-blue.svg' class='wizard_icon' title=\"$iconTitle\">";            
99
        }
100
        $content .= "<div class='$wizardClass'>".$input."</div></div>";
101
        return $content;        
102
    }
103
    
104
    
105
    public function setOptionsHelp($optionsList) {
106
        $this->optionsHelp = [];
107
        foreach ($optionsList as $option) {
108
            $this->optionsHelp[$option] = $this->displayName($option, true);
109
        }
110
        array_multisort(array_column($this->optionsHelp,'display'), SORT_ASC, $this->optionsHelp);
0 ignored issues
show
array_column($this->optionsHelp, 'display') cannot be passed to array_multisort() as the parameter $array expects a reference. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

110
        array_multisort(/** @scrutinizer ignore-type */ array_column($this->optionsHelp,'display'), SORT_ASC, $this->optionsHelp);
Loading history...
web\lib\admin\SORT_ASC cannot be passed to array_multisort() as the parameter $rest expects a reference. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

110
        array_multisort(array_column($this->optionsHelp,'display'), /** @scrutinizer ignore-type */ SORT_ASC, $this->optionsHelp);
Loading history...
111
    }
112
    
113
    public function setMessages() {
114
        // FED general
115
        $h = "<p><h3>" . _("Here you set federation-level options.") . "</h3><p>";
116
        $h .= "<i>" . _("The following options are available:") . "</i><p>";
117
        if (isset($this->optionsHelp)) {
118
            $h .= "<dl>";
119
            foreach ($this->optionsHelp as $o) {
120
                $h .= "<dt>". $o['display'] . "</dt>";
121
                $h .= "<dd>" . $o['help'] . "</dd>";
122
            }
123
            $h .= "</dl>";
124
        }
125
        $this->helpMessage['fed_general'] = $h;
126
        // SUPPORT
127
        $h = "<p>" . _("This section can be used to upload specific Terms of Use for your users and to display details of how your users can reach your local helpdesk.") . "</p>";
128
        if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL") {
129
            $h .= "<p>" .
130
            sprintf(_("Do you provide helpdesk services for your users? If so, it would be nice if you would tell us the pointers to this helpdesk."), $this->nomenclatureParticipant) . "</p>" .
131
            "<p>" .
132
            _("If you enter a value here, it will be added to the installers for all your users, and will be displayed on the download page. If you operate separate helpdesks for different user groups (we call this 'profiles') specify per-profile helpdesk information later in this wizard. If you operate no help desk at all, just leave these fields empty.") . "</p>";
133
            if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
134
                $h .= "<p>" . sprintf(_("For %s deployments, providing at least a local e-mail contact is required."), \config\ConfAssistant::SILVERBULLET['product_name']) . " " . _("This is the contact point for your organisation. It may be displayed publicly.") . "</p>";
135
            }
136
        } elseif (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
137
            $h .= "<p>" . _("Providing at least a local support e-mail contact is required.") . " " . _("This is the contact point for your end users' level 1 support.") . "</p>";
138
        }
139
        $this->helpMessage['support'] = $h;
140
141
        // MEDIA
142
        $h = "<p>" .
143
            sprintf(_("In this section, you define on which media %s should be configured on user devices."), \config\ConfAssistant::CONSORTIUM['display_name']) . "</p><ul>";
144
        $h .= "<li>";
145
        $h .= "<strong>" . ( count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>";
146
        if (count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0) {
147
            $ssidlist = "";
148
            foreach (\config\ConfAssistant::CONSORTIUM['ssid'] as $ssid) {
149
                $ssidlist .= ", '<strong>" . $ssid . "</strong>'";
150
            }
151
            $ssidlist = substr($ssidlist, 2);
152
             $h .= sprintf(ngettext("We will always configure this SSID for WPA2/AES: %s.", "We will always configure these SSIDs for WPA2/AES: %s.", count(\config\ConfAssistant::CONSORTIUM['ssid'])), $ssidlist);
153
             $h .= "<br/>" . sprintf(_("It is also possible to define custom additional SSIDs with the option '%s' below."), $this->displayName("media:SSID"));
154
        } else {
155
             $h .=  _("Please configure which SSIDs should be configured in the installers.");
156
        }
157
         $h .= " " . _("By default, we will only configure the SSIDs with WPA2/AES encryption. By using the '(with WPA/TKIP)' option you can specify that we should include legacy support for WPA/TKIP where possible.");
158
         $h .= "</li>";
159
160
        $h .= "<li>";
161
        $h .= "<strong>" . ( count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>";
162
        if (count(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi']) > 0) {
163
            $consortiumlist = "";
164
            foreach (\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'] as $oi) {
165
                $consortiumlist .= ", '<strong>" . $oi . "</strong>'";
166
            }
167
            $consortiumlist = substr($consortiumlist, 2);
168
            $h .= sprintf(ngettext("We will always configure this Consortium OI: %s.", "We will always configure these Consortium OIs: %s.", count(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'])), $consortiumlist);
169
170
            $h .= "<br/>" . sprintf(_("It is also possible to define custom additional OIs with the option '%s' below."), $this->displayName("media:consortium_OI"));
171
        } else {
172
            $h .= _("Please configure which Consortium OIs should be configured in the installers.");
173
        }
174
        $h .= "</li>";
175
        $h .= "<li><strong>" . _("Support for wired IEEE 802.1X:") . " </strong>"
176
        . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail).") .
177
        "</li>";
178
        $h .= "<li><strong>" . _("Removal of bootstrap/onboarding SSIDs:") . " </strong>"
179
        . _("If you use a captive portal to distribute configurations, you may want to unconfigure/disable that SSID after the bootstrap process. With this option, the SSID will either be removed, or be defined as 'Only connect manually'.")
180
        . "</li>";
181
        $h .= "</ul>";
182
        $this->helpMessage['media'] = $h;
183
        
184
        // IDP GENERAL
185
        $h = "<p>" .
186
        _("Some properties are valid across all deployment profiles. This is the place where you can describe those properties in a fine-grained way. The solicited information is used as follows:") . "</p>".
187
            "<ul>".
188
                "<li>"._("<strong>Logo</strong>: When you submit a logo, we will embed this logo into all installers where a custom logo is possible. We accept any image format, but for best results, we suggest SVG. If you don't upload a logo, we will use the generic logo instead (see top-right corner of this page).") . "</li>".
189
                "<li>".sprintf(_("<strong>%s</strong>: The organisation may have names in multiple languages. It is recommended to always populate at least the 'default/other' language, as it is used as a fallback if the system does not have a name in the exact language the user requests a download in."), $this->displayName("general:instname"))."</li>".
190
                "<li>".sprintf(_("<strong>%s</strong>: This acronym will be used as an element of the installer file name instead of one automatically created from first letters of every word in the institution name. You may add acronyms for multiple languages (but only one per language). The acronym will also be used as a keyword for the organisation search on the user's downloads page."), $this->displayName("general:instshortname"))."</li>".
191
                "<li>".sprintf(_("<strong>%s</strong>: You may add several versions of the organisation name or acronyms which will be used as additional keywords exclusively for the organisation search on the user's downloads page."), $this->displayName("general:instaltname"))."</li>".
192
            "</ul>";
193
        $this->helpMessage['idp_general'] = $h;
194
        
195
        // PROFILE GENERAL
196
        $h = "<p>" . _("First of all we need a name for the profile. This will be displayed to end users, so you may want to choose a descriptive name like 'Professors', 'Students of the Faculty of Bioscience', etc.") . "</p>".
197
            "<p>" . _("Optionally, you can provide a longer descriptive text about who this profile is for. If you specify it, it will be displayed on the download page after the user has selected the profile name in the list.") . "</p>".
198
            "<p>" . _("You can also tell us your RADIUS realm. ");
199
            if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] !== NULL) {
200
               $h .= sprintf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), \config\ConfAssistant::CONSORTIUM['display_name']);
201
            }
202
        $h .= _("It is required to enter the realm name if you want to support anonymous outer identities (see below).") . "</p>";
203
        $this->helpMessage['profile'] = $h;
204
        
205
        // REALM
206
        $h = "<p>".sprintf(_("Some installers support a feature called 'Anonymous outer identity'. If you don't know what this is, please read <a href='%s'>this article</a>."), "https://confluence.terena.org/display/H2eduroam/eap-types")."</p>".
207
          "<p>"._("On some platforms, the installers can suggest username endings and/or verify the user input to contain the realm suffix.")."</p>".
208
          "<p>"._("The realm check feature needs to know an outer ID which actually gets a chance to authenticate. If your RADIUS server lets only select usernames pass, it is useful to supply the information which of those (outer ID) username we can use for testing.")."</p>";
209
        $this->helpMessage['realm'] = $h;
210
        
211
        // REDIRECT
212
         $h ="<p>"._("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
213
        $this->helpMessage['redirect'] = $h;
214
        
215
        // EAP
216
        $h = "<p>"._("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
217
        $this->helpMessage['eap_support'] = $h;
218
        
219
        // LOCATIOM
220
        $h = "<p>" .
221
                    _("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.") .
222
                    "</p>
223
                     <ul>" .
224
                    _("<li>Drag the marker in the map to your place, or</li>
225
<li>enter your street address in the field below for lookup, or</li>
226
<li>use the 'Locate Me!' button</li>") .
227
                    "</ul>
228
                     <strong>" .
229
                    _("We will use the coordinates as indicated by the marker for geolocation.") .
230
                    "</strong>";
231
        $this->helpMessage['location'] = $h;
232
    }
233
}
234
235