Issues (1844)

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.

class/ConfigOptionHandler.php (4 issues)

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xhelp;
4
5
/*
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @copyright    {@link https://xoops.org/ XOOPS Project}
17
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
18
 * @author       Brian Wahoff <[email protected]>
19
 * @author       Eric Juden <[email protected]>
20
 * @author       XOOPS Development Team
21
 */
22
23
/**
24
 * class ConfigOptionHandler
25
 */
26
class ConfigOptionHandler extends \XoopsConfigOptionHandler
27
{
28
    /**
29
     * Autoincrementing DB fieldname
30
     * @var string
31
     */
32
    public $idfield = 'confop_id';
33
34
    /**
35
     * Constructor
36
     *
37
     * @param \XoopsDatabase|null $db reference to a xoopsDB object
38
     */
39
    public function init(\XoopsDatabase $db = null): void
40
    {
41
        $this->db = $db;
42
    }
43
44
    /**
45
     * DB table name
46
     *
47
     * @var string
48
     */
49
    public $dbtable = 'configoption';
50
51
    private const TABLE = 'xhelp_ticket_fields';
52
    private const ENTITY = TicketField::class;
53
    private const ENTITYNAME = 'TicketField';
54
    private const KEYNAME = 'id';
55
    private const IDENTIFIER = 'name';
56
57
    /**
58
     * delete configoption matching a set of conditions
59
     *
60
     * @param \CriteriaElement|\CriteriaCompo|null $criteria {@link CriteriaElement}
61
     * @param bool                                 $force
62
     * @return bool FALSE if deletion failed
63
     */
64
    public function deleteAll(\CriteriaElement $criteria = null, bool $force = false): bool
65
    {
66
        $sql = 'DELETE FROM ' . $this->db->prefix($this->dbtable);
67
        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
68
            $sql .= ' ' . $criteria->renderWhere();
69
        }
70
        if ($force) {
71
            $result = $this->db->queryF($sql);
72
        } else {
73
            $result = $this->db->query($sql);
74
        }
75
        if (!$result) {
76
            return false;
77
        }
78
        return true;
79
    }
80
81
    /**
82
     * Insert a new option in the database
83
     *
84
     * @param \XoopsObject $confoption reference to a {@link XoopsConfigOption}
85
     * @param bool         $force
86
     * @return bool|int TRUE if successfull.
87
     */
88
    public function insert(\XoopsObject $confoption, bool $force = false)
89
    {
90
        if ('xoopsconfigoption' !== \mb_strtolower(\get_class($confoption))) {
91
            return false;
92
        }
93
        if (!$confoption->isDirty()) {
94
            return true;
95
        }
96
        if (!$confoption->cleanVars()) {
97
            return false;
98
        }
99
        //TODO mb replace with individual variables
100
        foreach ($confoption->cleanVars as $k => $v) {
101
            ${$k} = $v;
102
        }
103
        if ($confoption->isNew()) {
104
            $confop_id = $this->db->genId('configoption_confop_id_seq');
105
            $sql       = \sprintf('INSERT INTO `%s` (confop_id, confop_name, confop_value, conf_id) VALUES (%u, %s, %s, %u)', $this->db->prefix('configoption'), $confop_id, $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $conf_id);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $confop_value does not exist. Did you maybe mean $confop_id?
Loading history...
Comprehensibility Best Practice introduced by
The variable $conf_id does not exist. Did you maybe mean $confop_id?
Loading history...
Comprehensibility Best Practice introduced by
The variable $confop_name does not exist. Did you maybe mean $confop_id?
Loading history...
106
        } else {
107
            $sql = \sprintf('UPDATE `%s` SET confop_name = %s, confop_value = %s WHERE confop_id = %u', $this->db->prefix('configoption'), $this->db->quoteString($confop_name), $this->db->quoteString($confop_value), $confop_id);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $confop_id seems to be never defined.
Loading history...
108
        }
109
110
        if ($force) {
111
            $result = $this->db->queryF($sql);
112
        } else {
113
            $result = $this->db->query($sql);
114
        }
115
        if (!$result) {
116
            return false;
117
        }
118
        if (empty($confop_id)) {
119
            $confop_id = $this->db->getInsertId();
120
        }
121
        $confoption->assignVar('confop_id', $confop_id);
122
123
        return $confop_id;
124
    }
125
}
126