Issues (63)

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.

source/API/VKAccount.php (5 issues)

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
namespace FreedomCore\VK\API;
4
5
use FreedomCore\VK\VKBase;
6
7
class VKAccount extends VKAPI {
8
9
    /**
10
     * API Method for this class
11
     * @var string
12
     */
13
    protected $apiMethod = 'account.';
14
15
    /**
16
     * Default Filters To Be Used
17
     */
18
    const defaultFilters = [ 'friends', 'messages', 'groups' ];
19
20
    /**
21
     * VKAccount constructor.
22
     * @param VKBase $vkObject
23
     */
24
    public function __construct(VKBase $vkObject) {
25
        parent::__construct($vkObject);
26
        parent::isAllowed();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (isAllowed() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->isAllowed().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
27
    }
28
29
    /**
30
     * Returns non-null values of user counters
31
     * @param array $selectedFilters
32
     * @return array
33
     */
34
    public function getCounters($selectedFilters = self::defaultFilters) {
35
        $requestParameters = [
36
            'filter'    =>  $this->getAllowedFilters($selectedFilters)
37
        ];
38
39
        return parent::executeQuery(__FUNCTION__, $requestParameters);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (executeQuery() instead of getCounters()). Are you sure this is correct? If so, you might want to change this to $this->executeQuery().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
40
    }
41
42
    /**
43
     * Sets an application screen name (up to 17 characters), that is shown to the user in the left menu.
44
     * @param $userID
45
     * @param $applicationName
46
     * @return mixed
47
     */
48
    public function setNameInMenu($userID, $applicationName) {
49
        $requestParameters = [
50
            'user_id'   =>  $userID,
51
            'name'      =>  $applicationName
52
        ];
53
54
        return parent::executeQuery(__FUNCTION__, $requestParameters);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (executeQuery() instead of setNameInMenu()). Are you sure this is correct? If so, you might want to change this to $this->executeQuery().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
55
    }
56
57
    /**
58
     * Marks the current user as online for 15 minutes.
59
     * (This method is available only to standalone-applications.)
60
     * @return mixed
61
     */
62
    public function setOnline() {
63
        $requestParameters = [
64
            'voip'  =>  1
65
        ];
66
        return $this->executeQuery(__FUNCTION__, $requestParameters);
67
    }
68
69
    /**
70
     * Marks a current user as Offline.
71
     * (This method is available only to standalone-applications.)
72
     * @return mixed
73
     */
74
    public function setOffline() {
75
        return $this->executeQuery(__FUNCTION__, [ ]);
76
    }
77
78
    /**
79
     * Returns a list of active ads (offers) which executed by the user will bring him/her respective number of votes to his balance in the application.
80
     * @param int $setOffset
81
     * @param int $setCount
82
     * @return array
83
     */
84
    public function getActiveOffers($setOffset = 0, $setCount = 100) {
85
        $requestParameters = [
86
            'offset'        =>  $setOffset,
87
            'count'         =>  ($setCount > 100 || $setCount < 0) ? 100 : $setCount
88
        ];
89
90
        return parent::executeQuery(__FUNCTION__, $requestParameters);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (executeQuery() instead of getActiveOffers()). Are you sure this is correct? If so, you might want to change this to $this->executeQuery().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
91
    }
92
93
    /**
94
     * Gets settings of the current user in this application.
95
     * @param int $userID
96
     * @return mixed
97
     */
98
    public function getAppPermissions($userID) {
99
        $requestParameters = [
100
            'user_id'   =>  $userID
101
        ];
102
103
        return parent::executeQuery(__FUNCTION__, $requestParameters);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (executeQuery() instead of getAppPermissions()). Are you sure this is correct? If so, you might want to change this to $this->executeQuery().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
104
    }
105
106
    /**
107
     * Get String of Filters Which Are Allowed To Be Used
108
     * @param $filtersArray
109
     * @return string
110
     */
111
    private function getAllowedFilters($filtersArray) {
112
        $existingFilters = [
113
            'friends',
114
            'messages',
115
            'photos',
116
            'videos',
117
            'notes',
118
            'gifts',
119
            'events',
120
            'groups',
121
            'sdk'
122
        ];
123
        
124
        foreach ($filtersArray as $fKey => $fValue) { 
125
            if (!in_array($fValue, $existingFilters)) {
126
                unset($filtersArray[ $fKey ]); 
127
            }
128
        }
129
        return implode(',', $filtersArray);
130
    }
131
}