Issues (20)

Security Analysis    no request data  

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.

Stanza/Iq/Query/Roster/Item.php (1 issue)

Severity

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
/**
3
 * Nucleus - XMPP Library for PHP
4
 *
5
 * Copyright (C) 2016, Some rights reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Xmpp\Stanza\Iq\Query\Roster;
17
18
19
use Kadet\Xmpp\Jid;
20
use Kadet\Xmpp\Xml\XmlElement;
21
22
/**
23
 * Class Item
24
 * @package Kadet\Xmpp\Stanza\Iq\Query\Roster
25
 *
26
 * @property bool $approved
27
 * @property string $ask
28
 * @property Jid $jid
29
 * @property string $name
30
 * @property string $subscription
31
 * @property string[] $groups
32
 */
33
class Item extends XmlElement
34
{
35
    public function __construct(Jid $jid, array $options = [])
36
    {
37
        $this->jid = $jid;
38
        parent::__construct('item', null, $options);
39
    }
40
41
    #region Approved
42
    /**
43
     * @return bool
44
     */
45
    public function getApproved(): bool
46
    {
47
        return $this->getAttribute('approved') === 'true';
48
    }
49
50
    /**
51
     * @param bool $approved
52
     */
53
    public function setApproved(bool $approved)
54
    {
55
        $this->setAttribute('approved', $approved ? 'true' : 'false');
56
    }
57
    #endregion
58
59
    #region Ask
60
    /**
61
     * @return string
62
     */
63
    public function getAsk(): string
64
    {
65
        return $this->getAttribute('ask');
66
    }
67
68
    /**
69
     * @param string $ask
70
     */
71
    public function setAsk(string $ask)
72
    {
73
        $this->setAttribute('ask', $ask);
74
    }
75
    #endregion
76
77
    #region Jid
78
    /**
79
     * @return Jid
80
     */
81
    public function getJid(): Jid
82
    {
83
        return new Jid($this->getAttribute('jid'));
84
    }
85
86
    /**
87
     * @param Jid $jid
88
     */
89
    public function setJid(Jid $jid)
90
    {
91
        $this->setAttribute('jid', (string)$jid);
92
    }
93
    #endregion
94
95
    #region Name
96
    /**
97
     * @return string
98
     */
99
    public function getName(): string
100
    {
101
        return $this->getAttribute('name');
102
    }
103
104
    /**
105
     * @param string $name
106
     */
107
    public function setName(string $name)
108
    {
109
        $this->setAttribute('name', $name);
110
    }
111
    #endregion
112
113
    #region Subscription
114
    /**
115
     * @return string
116
     */
117
    public function getSubscription(): string
118
    {
119
        return $this->getAttribute('subscription');
120
    }
121
122
    /**
123
     * @param string $subscription
124
     */
125
    public function setSubscription(string $subscription)
126
    {
127
        $this->setAttribute('subscription', $subscription);
128
    }
129
    #endregion
130
131
    #region Groups
132
    /**
133
     * @return string[]
134
     */
135
    public function getGroups(): array
136
    {
137
        return array_map(function(XmlElement $element) {
138
            return $element->innerXml;
139
        }, $this->elements('group', null) ?: []);
140
    }
141
142
    public function setGroups(array $groups)
143
    {
144
        $this->remove(\Kadet\Xmpp\Utils\filter\element\name('group'));
145
        $this->append(array_map(\Kadet\Xmpp\Utils\map\asElement('group'), $groups));
0 ignored issues
show
array_map(\Kadet\Xmpp\Ut...ment('group'), $groups) is of type array, but the function expects a object<Kadet\Xmpp\Xml\XmlElement>|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
146
    }
147
    #endregion
148
}
149