GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (41)

Security Analysis    no request data  

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.

src/Client.php (1 issue)

1
<?php
2
3
/**
4
 * Client class for Telegram Bot-API. Can be used for running bots in two supported modes:
5
 * daemon listener mode and webhook mode. Can easily be instantiated in any place of your application.
6
 *
7
 * @package Teebot (Telegram bot framework)
8
 *
9
 * @author  Stanislav Drozdov <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Teebot;
15
16
use Teebot\Configuration\{
17
    AbstractContainer,
18
    Config
19
};
20
use Teebot\Api\{
21
    Logger\Logger,
22
    Command\Processor,
23
    HttpClient,
24
    Method\GetUpdates,
25
    Response
26
};
27
28
class Client implements ClientInterface
29
{
30
    /**
31
     * @var AbstractContainer
32
     */
33
    protected $config;
34
35
    /**
36
     * @var Processor $processor
37
     */
38
    protected $processor;
39
40
    /**
41
     * @var Logger
42
     */
43
    protected $logger;
44
45
    public function __construct(AbstractContainer $config)
46
    {
47
        define('TEEBOT_ROOT', realpath(__DIR__ . '/../'));
48
49
        $this->init($config);
50
    }
51
52
    /**
53
     * Initializes the Client
54
     *
55
     * @param AbstractContainer $config
56
     */
57
    protected function init(AbstractContainer $config)
58
    {
59
        $this->config    = $config;
60
        $this->processor = new Processor($config, new HttpClient($config));
61
        $this->logger    = new Logger($config);
62
    }
63
64
    /**
65
     * Returns the latest updates from Telegram's API server
66
     *
67
     * @param int  $offset     Offset for the updates list
68
     * @param int  $limit      Limit of the updates to get
69
     * @param bool $silentMode If set to true then the events, mapped (in config or by default) to
70
     *                         the entities in the result will not be triggered
71
     * @return Response
72
     */
73
    public function getUpdates(
74
        $offset = Config::DEFAULT_OFFSET,
75
        $limit = Config::DEFAULT_LIMIT,
76
        $silentMode = false
77
    ): Response {
78
        $method = (new GetUpdates())
79
            ->setOffset($offset)
80
            ->setLimit($limit)
81
            ->setTimeout($this->config->get('timeout'));
82
83
        return $this->processor->call($method, $silentMode);
84
    }
85
86
    /**
87
     * Flushes the results and resets the offset pointer to the latest updates. Returns last offset.
88
     * Should be used to skip previous results from dialogs during first listener's start. Must not
89
     * be used for webhook.
90
     *
91
     * @return int
92
     */
93
    public function flush(): int
94
    {
95
        $response = $this->getUpdates(Config::DEFAULT_OFFSET, Config::DEFAULT_LIMIT, true);
96
97
        return $response instanceof Response ? $response->getOffset() : -1;
98
    }
99
100
    /**
101
     * Starts listener in daemon mode for receiving the updates from the chats. Should be used if webhook is not set.
102
     */
103
    public function listen()
104
    {
105
        $offset = $this->flush();
106
107
        while (1) {
108
            try {
109
                $response = $this->getUpdates($offset);
110
111
                if ($response instanceof Response) {
112
                    $offset = $response->getOffset();
113
                }
114
            } catch (\Exception $e){
115
                $this->logger->exception($e);
116
            }
117
118
            sleep($this->config->get('timeout'));
119
        }
120
    }
121
122
    /**
123
     * Returns Response object built from received data. Method should be used if
124
     * bot is running in webhook mode.
125
     *
126
     * @param string $receivedData Received data from Telegram's webhook call. Not required, but could
127
     *                             be passed manually. If not passed - php input will be used to get the data.
128
     * @param bool   $silentMode   If set to true then the events, mapped to
129
     *                             the entities in the result will not be triggered
130
     * @return Response
131
     */
132
    public function webhook($receivedData = '', $silentMode = false): Response
133
    {
134
        if (empty($receivedData)) {
135
            $receivedData = file_get_contents("php://input");
136
        }
137
138
        if (empty($receivedData)) {
139
            return null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return null returns the type null which is incompatible with the type-hinted return Teebot\Api\Response.
Loading history...
140
        }
141
142
        return $this->processor->getWebhookResponse($receivedData, $silentMode);
143
    }
144
}
145