Issues (51)

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/Standards/BestIt/CodeSniffer/CodeWarning.php (1 issue)

Labels
Severity

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 BestIt\CodeSniffer;
6
7
use Exception;
8
9
/**
10
 * The warning of a code does not conform to the style guide.
11
 *
12
 * We use the exception code as a string like the PDOException does, not as an integer.
13
 *
14
 * @author blange <[email protected]>
15
 * @package BestIt\CodeSniffer
16
 */
17
class CodeWarning extends Exception
18
{
19
    /**
20
     * Is this topic fixable?
21
     *
22
     * @var bool
23
     */
24
    private bool $isFixable = false;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
25
26
    /**
27
     * The payload for displaying the error message.
28
     *
29
     * @var array
30
     */
31
    private array $payload = [];
32
33
    /**
34
     * The position of the error.
35
     *
36
     * @var int
37
     */
38
    private int $stackPosition;
39
40
    /**
41
     * The erroneous token.
42
     *
43
     * @var array|void
44
     */
45
    private $token;
46
47
    /**
48
     * CodeWarning constructor.
49
     *
50
     * @param string $code The code for the sniffer.
51
     * @param string $message The message for the sniffer.
52
     * @param int $stackPosition Where is the token in the stack?
53
     */
54
    public function __construct(string $code, string $message, int $stackPosition)
55
    {
56
        parent::__construct($message);
57
58
        // The docs allow, that the code is not numeric (like in the PDOException) but the type hint is a number,
59
        // so we just use the property.
60
        $this->code = $code;
61
        $this->stackPosition = $stackPosition;
62
    }
63
64
    /**
65
     * Returns the payload for displaying the error message.
66
     *
67
     * @return array The possible payload for the error message.
68
     */
69
    public function getPayload(): array
70
    {
71
        return $this->payload;
72
    }
73
74
    /**
75
     * Returns the position of the error.
76
     *
77
     * @return int Where is the token in the stack?
78
     */
79
    public function getStackPosition(): int
80
    {
81
        return $this->stackPosition;
82
    }
83
84
    /**
85
     * Returns the erroneous token.
86
     *
87
     * @return array The "broken" token.
88
     */
89
    public function getToken(): array
90
    {
91
        return $this->token;
92
    }
93
94
    /**
95
     * Is this topic fixable?
96
     *
97
     * @param bool|null $newStatus If given the new status.
98
     *
99
     * @return bool Returns the "old" status if this is fixable.
100
     */
101
    public function isFixable(?bool $newStatus = null): bool
102
    {
103
        $oldStatus = $this->isFixable;
104
105
        if ($newStatus !== null) {
106
            $this->isFixable = $newStatus;
107
        }
108
109
        return $oldStatus;
110
    }
111
112
    /**
113
     * Sets the payload for displaying the error message.
114
     *
115
     * @param array $payload The possible payload for the error message.
116
     *
117
     * @return $this Fluent-Interface.
118
     */
119
    public function setPayload(array $payload): self
120
    {
121
        $this->payload = $payload;
122
123
        return $this;
124
    }
125
126
    /**
127
     * Sets the erroneous token.
128
     *
129
     * @param array $token The "broken" token.
130
     *
131
     * @return $this Fluent Interface.
132
     */
133
    public function setToken(array $token): self
134
    {
135
        $this->token = $token;
136
137
        return $this;
138
    }
139
}
140