Issues (127)

Security Analysis    not enabled

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
Response Splitting can be used to send arbitrary responses.
  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.
  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
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.
  Header Injection
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.

include/update.php (4 issues)

1
<?php declare(strict_types=1);
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * Wgfilemanager module for xoops
14
 *
15
 * @param mixed      $module
16
 * @param null|mixed $prev_version
17
 * @author         Wedega - Email:<[email protected]> - Website:<https://wedega.com>
18
 * @copyright      module for xoops
19
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
20
 */
21
22
use XoopsModules\Wgfilemanager\Common\ {
23
    Configurator,
24
    Migrate,
25
    MigrateHelper
26
};
27
28
/**
29
 * @param      $module
30
 * @param null $prev_version
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prev_version is correct as it would always require null to be passed?
Loading history...
31
 *
32
 * @return bool|null
33
 */
34
function xoops_module_update_wgfilemanager($module, $prev_version = null)
0 ignored issues
show
The parameter $prev_version is not used and could be removed. ( Ignorable by Annotation )

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

34
function xoops_module_update_wgfilemanager($module, /** @scrutinizer ignore-unused */ $prev_version = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
{
36
    $ret = null;
0 ignored issues
show
The assignment to $ret is dead and can be removed.
Loading history...
37
38
    $moduleDirName = $module->dirname();
39
40
    $ret = wgfilemanager_check_db($module);
41
42
    //check upload directory
43
    require_once __DIR__ . '/install.php';
44
    $ret = xoops_module_install_wgfilemanager($module);
45
    // update DB corresponding to sql/mysql.sql
46
    $configurator = new Configurator();
47
    $migrate = new Migrate($configurator);
48
49
    $fileSql = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/sql/mysql.sql';
50
    // ToDo: add function setDefinitionFile to .\class\libraries\vendor\xoops\xmf\src\Database\Migrate.php
51
    // Todo: once we are using setDefinitionFile this part has to be adapted
52
    //$fileYaml = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/sql/update_' . $moduleDirName . '_migrate.yml';
53
    //try {
54
    //$migrate->setDefinitionFile('update_' . $moduleDirName);
55
    //} catch (\Exception $e) {
56
    // as long as this is not done default file has to be created
57
    $moduleVersionOld = $module->getInfo('version');
58
    $moduleVersionNew = \str_replace(['.', '-'], '_', $moduleVersionOld);
59
    $fileYaml = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . "/sql/{$moduleDirName}_{$moduleVersionNew}_migrate.yml";
60
    //}
61
62
    // create a schema file based on sql/mysql.sql
63
    $migratehelper = new MigrateHelper($fileSql, $fileYaml);
64
    if (!$migratehelper->createSchemaFromSqlfile()) {
65
        \xoops_error('Error: creation schema file failed!');
66
        return false;
67
    }
68
69
    // run standard procedure for db migration
70
    $migrate->getTargetDefinitions();
71
    $migrate->synchronizeSchema();
72
73
    $errors = $module->getErrors();
74
    if (!empty($errors)) {
75
        \print_r($errors);
76
    }
77
78
    return $ret;
79
}
80
81
/**
82
 * @param $module
83
 *
84
 * @return bool
85
 */
86
function wgfilemanager_check_db($module)
0 ignored issues
show
The parameter $module is not used and could be removed. ( Ignorable by Annotation )

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

86
function wgfilemanager_check_db(/** @scrutinizer ignore-unused */ $module)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
87
{
88
    //insert here code for database check
89
90
    /*
91
    // Example: update table (add new field)
92
    $ret = true;
93
    $table   = $GLOBALS['xoopsDB']->prefix('wgfilemanager_images');
94
    $field   = 'img_exif';
95
    $check   = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'");
96
    $numRows = $GLOBALS['xoopsDB']->getRowsNum($check);
97
    if (!$numRows) {
98
        $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;";
99
        if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
100
            xoops_error($GLOBALS['xoopsDB']->error() . '<br>' . $sql);
101
            $module->setErrors("Error when adding '$field' to table '$table'.");
102
            $ret = false;
103
        }
104
    }
105
106
    // Example: create new table
107
    $table   = $GLOBALS['xoopsDB']->prefix('wgfilemanager_categories');
108
    $check   = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'");
109
    $numRows = $GLOBALS['xoopsDB']->getRowsNum($check);
110
    if (!$numRows) {
111
        // create new table 'wgfilemanager_categories'
112
        $sql = "CREATE TABLE `$table` (
113
                  `cat_id`        INT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
114
                  `cat_text`      VARCHAR(100)    NOT NULL DEFAULT '',
115
                  `cat_date`      INT(8)          NOT NULL DEFAULT '0',
116
                  `cat_submitter` INT(8)          NOT NULL DEFAULT '0',
117
                  PRIMARY KEY (`cat_id`)
118
                ) ENGINE=InnoDB;";
119
        if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
120
            xoops_error($GLOBALS['xoopsDB']->error() . '<br>' . $sql);
121
            $module->setErrors("Error when creating table '$table'.");
122
            $ret = false;
123
        }
124
    }
125
    return $ret;
126
    */
127
    return true;
128
}
129