Issues (9)

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.

src/Frame/GoAwayFrame.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
declare(strict_types=1);
3
namespace Hyphper\Frame;
4
5
use Hyphper\Frame\Exception\InvalidFrameException;
6
7
/**
8
 * The GOAWAY frame informs the remote peer to stop creating streams on this
9
 * connection. It can be sent from the client or the server. Once sent, the
10
 * sender will ignore frames sent on new streams for the remainder of the
11
 * connection.
12
 *
13
 * @package Hyphper\Frame
14
 */
15
class GoAwayFrame extends \Hyphper\Frame
16
{
17
    protected $defined_flags = [];
18
    protected $type = 0x07;
19
    protected $stream_association = self::NO_STREAM;
20
    protected $last_stream_id;
21
    protected $error_code;
22
    protected $additional_data;
23
24 5 View Code Duplication
    public function __construct(array $options = [])
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26 5
        parent::__construct($options);
27 4
        $this->last_stream_id = (int) ($options['last_stream_id'] ?? 0);
28 4
        $this->error_code = (int) ($options['error_code'] ?? 0);
29 4
        $this->additional_data = (int) ($options['additional_data'] ?? '');
30 4
    }
31
32 1
    public function serializeBody(): string
33
    {
34 1
        $data = pack(
35 1
            'NN',
36 1
            $this->last_stream_id & 0x7FFFFFFF,
37 1
            $this->error_code
38
        );
39
40 1
        $data .= $this->additional_data;
41
42 1
        return $data;
43
    }
44
45
    /**
46
     * Given the body of a frame, parses it into frame data. This populates
47
     * the non-header parts of the frame: that is, it does not populate the
48
     * stream ID or flags.
49
     *
50
     *
51
     * @param string $data
52
     *
53
     * @return void
54
     */
55 2
    public function parseBody(string $data)
56
    {
57 2 View Code Duplication
        if (!$unpack = @unpack('Nlast_stream_id/Nerror_code', substr($data, 0, 8))) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58 1
            throw new InvalidFrameException('Invalid GOAWAY body.');
59
        }
60
61 1
        $this->last_stream_id = $unpack['last_stream_id'];
62 1
        $this->error_code = $unpack['error_code'];
63
64 1
        $this->body_len = strlen($data);
65 1
        if (strlen($data) > 8) {
66 1
            $this->additional_data = substr($data, 8);
67
        }
68 1
    }
69
70
    /**
71
     * @param int $last_stream_id
72
     *
73
     * @return GoAwayFrame
74
     */
75 1
    public function setLastStreamId($last_stream_id)
76
    {
77 1
        $this->last_stream_id = $last_stream_id;
78
79 1
        return $this;
80
    }
81
82
    /**
83
     * @return int
84
     */
85
    public function getLastStreamId()
86
    {
87
        return $this->last_stream_id;
88
    }
89
90
    /**
91
     * @param int $error_code
92
     *
93
     * @return GoAwayFrame
94
     */
95 1
    public function setErrorCode($error_code)
96
    {
97 1
        $this->error_code = $error_code;
98
99 1
        return $this;
100
    }
101
102
    /**
103
     * @return int
104
     */
105
    public function getErrorCode()
106
    {
107
        return $this->error_code;
108
    }
109
110
    /**
111
     * @param int $additional_data
112
     *
113
     * @return GoAwayFrame
114
     */
115 1
    public function setAdditionalData($additional_data)
116
    {
117 1
        $this->additional_data = $additional_data;
118
119 1
        return $this;
120
    }
121
122
    /**
123
     * @return int
124
     */
125 1
    public function getAdditionalData()
126
    {
127 1
        return $this->additional_data;
128
    }
129
}
130