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/VKAPI.php (2 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
use FreedomCore\VK\VKException;
7
8
class VKAPI {
9
10
    /**
11
     * VK Object
12
     * @var VKBase
13
     */
14
    protected $VKObject;
15
16
    /**
17
     * API Method for this class
18
     * @var string
19
     */
20
    protected $apiMethod = '';
21
22
    const PERMISSION_NOTIFY         = 1;
23
    const PERMISSION_FRIENDS        = 2;
24
    const PERMISSION_PHOTOS         = 4;
25
    const PERMISSION_AUDIO          = 8;
26
    const PERMISSION_VIDEO          = 16;
27
    const PERMISSION_DOCS           = 131072;
28
    const PERMISSION_NOTES          = 2048;
29
    const PERMISSION_PAGES          = 128;
30
    const PERMISSION_LMLINK         = 256;
31
    const PERMISSION_STATUS         = 1024;
32
    const PERMISSION_OFFERS         = 32;
33
    const PERMISSION_QUESTIONS      = 64;
34
    const PERMISSION_WALL           = 8192;
35
    const PERMISSION_GROUPS         = 262144;
36
    const PERMISSION_MESSAGES       = 4096;
37
    const PERMISSION_EMAIL          = 4194304;
38
    const PERMISSION_NOTIFICATIONS  = 524288;
39
    const PERMISSION_STATS          = 1048576;
40
    const PERMISSION_ADDS           = 32768;
41
42
43
    /**
44
     * VKUsers constructor.
45
     * @param VKBase $vkObject
46
     */
47
    public function __construct(VKBase $vkObject) {
48
        $this->VKObject = $vkObject;
49
    }
50
51
    /**
52
     * Is User Authorized To Make an API Request
53
     * @param int $requiredPermission
54
     * @return boolean|null
55
     * @throws VKException
56
     */
57
    protected function isAllowed($requiredPermission = null) {
58
        if ($requiredPermission != null) {
59
            try {
60
                $isValidPermission = $this->VKObject->getPermissionsMask() & $requiredPermission;
61
                if (!$isValidPermission) {
62
                    throw new VKException('Insufficient Permissions Received!', 1);
63
                }
64
            } catch (VKException $ex) {
65
                echo $ex->getMessage();
66
                die();
0 ignored issues
show
Coding Style Compatibility introduced by
The method isAllowed() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
67
            }
68
        }
69
70
        try {
71
            if (!$this->VKObject->isAuthorized()) {
72
                throw new VKException('User not Authorized to make this API Request!', 1);
73
            }
74
        } catch (VKException $ex) {
75
            echo $ex->getMessage();
76
            die();
0 ignored issues
show
Coding Style Compatibility introduced by
The method isAllowed() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
77
        }
78
    }
79
80
    /**
81
     * Execute API Call
82
     * @param string $apiMethod
83
     * @param $requestParameters
84
     * @return mixed
85
     */
86
    protected function executeQuery($apiMethod, $requestParameters) {
87
        return $this->VKObject->apiQuery($this->apiMethod.$apiMethod, $requestParameters);
88
    }
89
}