Issues (56)

Security Analysis    not enabled

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.

src/Messenger.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
declare(strict_types=1);
4
5
namespace Kerox\Messenger;
6
7
use GuzzleHttp\Client;
8
use GuzzleHttp\ClientInterface;
9
use Kerox\Messenger\Api\Broadcast;
10
use Kerox\Messenger\Api\Code;
11
use Kerox\Messenger\Api\Insights;
12
use Kerox\Messenger\Api\Nlp;
13
use Kerox\Messenger\Api\Persona;
14
use Kerox\Messenger\Api\Profile;
15
use Kerox\Messenger\Api\Send;
16
use Kerox\Messenger\Api\Tag;
17
use Kerox\Messenger\Api\Thread;
18
use Kerox\Messenger\Api\User;
19
use Kerox\Messenger\Api\Webhook;
20
use Psr\Http\Message\ServerRequestInterface;
21
22
class Messenger
23
{
24
    public const API_URL = 'https://graph.facebook.com/';
25
    public const API_VERSION = 'v5.0';
26
27
    /**
28
     * @var string
29
     */
30
    protected $appSecret;
31
32
    /**
33
     * @var string
34
     */
35
    protected $verifyToken;
36
37
    /**
38
     * @var string
39
     */
40
    protected $pageToken;
41
42
    /**
43
     * @var \GuzzleHttp\ClientInterface
44
     */
45
    protected $client;
46
47
    /**
48
     * Messenger constructor.
49
     */
50 1
    public function __construct(
51
        string $appSecret,
52
        string $verifyToken,
53
        string $pageToken,
54
        string $apiVersion = self::API_VERSION,
55
        ?ClientInterface $client = null
56
    ) {
57 1
        $this->appSecret = $appSecret;
58 1
        $this->verifyToken = $verifyToken;
59 1
        $this->pageToken = $pageToken;
60
61 1
        if ($client === null) {
62 1
            $client = new Client([
63 1
                'base_uri' => self::API_URL . $apiVersion . '/',
64
            ]);
65
        }
66 1
        $this->client = $client;
67 1
    }
68
69 1
    public function send(): Send
70
    {
71 1
        return new Send($this->pageToken, $this->client);
72
    }
73
74 1
    public function webhook(?ServerRequestInterface $request = null): Webhook
75
    {
76 1
        return new Webhook($this->appSecret, $this->verifyToken, $this->pageToken, $this->client, $request);
77
    }
78
79 1
    public function user(): User
80
    {
81 1
        return new User($this->pageToken, $this->client);
82
    }
83
84 1
    public function profile(): Profile
85
    {
86 1
        return new Profile($this->pageToken, $this->client);
87
    }
88
89 1
    public function code(): Code
90
    {
91 1
        return new Code($this->pageToken, $this->client);
0 ignored issues
show
Deprecated Code introduced by
The class Kerox\Messenger\Api\Code has been deprecated with message: Since version 3.2.0 and will be removed in version 4.0.0.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
92
    }
93
94 1
    public function insights(): Insights
95
    {
96 1
        return new Insights($this->pageToken, $this->client);
97
    }
98
99 1
    public function tag(): Tag
100
    {
101 1
        return new Tag($this->pageToken, $this->client);
102
    }
103
104 1
    public function thread(): Thread
105
    {
106 1
        return new Thread($this->pageToken, $this->client);
107
    }
108
109 1
    public function nlp(): Nlp
110
    {
111 1
        return new Nlp($this->pageToken, $this->client);
112
    }
113
114 1
    public function broadcast(): Broadcast
115
    {
116 1
        return new Broadcast($this->pageToken, $this->client);
0 ignored issues
show
Deprecated Code introduced by
The class Kerox\Messenger\Api\Broadcast has been deprecated with message: Since version 3.2.0 and will be removed in version 4.0.0.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
117
    }
118
119 1
    public function persona(): Persona
120
    {
121 1
        return new Persona($this->pageToken, $this->client);
122
    }
123
}
124