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/user/Skinjob.php (1 issue)

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
/**
23
 * This file contains a class for handling switching between skin frontends.
24
 *
25
 * @package Developer
26
 */
27
/**
28
 * 
29
 */
30
31
namespace web\lib\user;
32
33
use \Exception;
0 ignored issues
show
The type \Exception was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
35
/**
36
 * This class handles user UI skin handling.
37
 * 
38
 * @author Stefan Winter <[email protected]>
39
 */
40
class Skinjob {
41
42
    /**
43
     * The skin that was selected
44
     * 
45
     * @var string
46
     */
47
    public $skin;
48
    
49
    /**
50
     * Initialise the skin.
51
     * 
52
     * @param string $selectedSkin the name of the skin to use
53
     */
54
    public function __construct($selectedSkin = NULL) {
55
        // input may have been rubbish. Sanity-check and fall back to default skin if needed
56
        $actualSkin = \config\Master::APPEARANCE['skins'][0];
57
        if (in_array($selectedSkin, \config\Master::APPEARANCE['skins'])) {
58
            $correctIndex = array_search($selectedSkin, \config\Master::APPEARANCE['skins']);
59
            $actualSkin = \config\Master::APPEARANCE['skins'][$correctIndex];
60
        }
61
62
        $this->skin = $actualSkin;
63
        $_SESSION['skin'] = $actualSkin;
64
65
    }
66
67
    /**
68
     * constructs a URL to the main resources directories. Searches for the file
69
     * first in the current skin's resource dir, then falls back to the global
70
     * resources dir, or returns FALSE if the requested file could not be found
71
     * at either location.
72
     * 
73
     * @param string $resourcetype which type of resource do we need a URL for?
74
     * @param string $filename     the name of the file being searched.
75
     * @param string $submodule    an area (diag, admin, ...) where to look
76
     * @return string|boolean the URL to the resource, or FALSE if this file does not exist
77
     * @throws Exception if something went wrong during the URL construction
78
     */
79
    public function findResourceUrl($resourcetype, $filename, $submodule = '') {
80
        switch ($resourcetype) {
81
            case "CSS":
82
                $path = "/resources/css/";
83
                break;
84
            case "IMAGES":
85
                $path = "/resources/images/";
86
                break;
87
            case "BASE":
88
                $path = "/";
89
                break;
90
            case "EXTERNAL":
91
                $path = "/external/";
92
                break;
93
            default:
94
                throw new Exception("findResourceUrl: unknown type of resource requested");
95
        }
96
97
        // does the file exist in the current skin's directory? Has precedence
98
        if ($submodule !== '' && file_exists(__DIR__ . "/../../skins/" . $this->skin . "/" . $submodule . $path . $filename)) {
99
            $extrapath = "/skins/" . $this->skin . "/" . $submodule;
100
        }
101
        elseif (file_exists(__DIR__ . "/../../skins/" . $this->skin . $path . $filename)) {
102
            $extrapath = "/skins/" . $this->skin;
103
        } elseif (file_exists(__DIR__ . "/../../" . $path . $filename)) {
104
            $extrapath = "";
105
        } else {
106
            return FALSE;
107
        }       
108
        return htmlspecialchars(\core\CAT::getRootUrlPath() . $extrapath . $path . $filename, ENT_QUOTES);
109
    }
110
111
}
112