Issues (77)

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/Rules/CheckResult.php (3 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 whm\Smoke\Rules;
4
5
use phm\HttpWebdriverClient\Http\Response\UriAwareResponse;
6
use Psr\Http\Message\ResponseInterface;
7
8
class CheckResult
9
{
10
    const STATUS_SUCCESS = 'success';
11
    const STATUS_FAILURE = 'failure';
12
    const STATUS_SKIPPED = 'skipped';
13
    const STATUS_NONE = 'none';
14
15
    const HINT_KEY = '__hint';
16
17
    const IDENTIFIER_RULE_STANDARD = 'standard';
18
    const IDENTIFIER_RULE_WITHOUT_SMOKE_PREFIX = 'withoutSmokePrefix';
19
20
    private $status;
21
    private $value;
22
    private $message;
23
24
    /**
25
     * @var Attribute[]
26
     */
27
    private $attributes = array();
28
    private $ruleName;
29
    private $url;
30
31
    private $tool;
32
    private $identifierRule = self::IDENTIFIER_RULE_STANDARD;
33
34
    /**
35
     * @var UriAwareResponse
36
     */
37
    private $response;
38
39
    /**
40
     * Result constructor.
41
     *
42
     * @param $status
43
     * @param $value
44
     * @param $message
45
     */
46
    public function __construct($status, $message = '', $value = null, $url = null)
47
    {
48
        $this->status = $status;
49
        $this->value = $value;
50
        $this->message = $message;
51
        $this->url = $url;
52
    }
53
54
    /**
55
     * @return Attribute[]
56
     */
57
    public function getAttributes()
58
    {
59
        return $this->attributes;
60
    }
61
62
    /**
63
     * @return boolean
64
     */
65
    public function hasAttribute($key)
66
    {
67
        foreach ($this->attributes as $attribute) {
68
            if ($attribute->getKey() == $key) {
69
                return true;
70
            }
71
        }
72
        return false;
73
    }
74
75
    /**
76
     * @param Attribute $attributes
0 ignored issues
show
There is no parameter named $attributes. Did you maybe mean $attribute?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
77
     */
78
    public function addAttribute(Attribute $attribute)
79
    {
80
        $this->attributes[] = $attribute;
81
    }
82
83
    /**
84
     * @param Attribute[] $attributes
85
     */
86
    public function addAttributes($attributes)
87
    {
88
        foreach ($attributes as $attribute) {
89
            $this->addAttribute($attribute);
90
        }
91
    }
92
93
    public function setHint($message)
94
    {
95
        $this->addAttribute(new Attribute(self::HINT_KEY, $message, false));
96
    }
97
98
    /**
99
     * @return mixed
100
     */
101
    public function getStatus()
102
    {
103
        return $this->status;
104
    }
105
106
    /**
107
     * @return mixed
108
     */
109
    public function getValue()
110
    {
111
        return $this->value;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getTool()
118
    {
119
        return $this->tool;
120
    }
121
122
    /**
123
     * @param string $tool
124
     */
125
    public function setTool($tool)
126
    {
127
        $this->tool = $tool;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getIdentifierRule()
134
    {
135
        return $this->identifierRule;
136
    }
137
138
    /**
139
     * @param string $identifier
0 ignored issues
show
There is no parameter named $identifier. Did you maybe mean $identifierRule?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
140
     */
141
    public function setIdentifierRule($identifierRule)
142
    {
143
        $this->identifierRule = $identifierRule;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getMessage()
150
    {
151
        return $this->message;
152
    }
153
154
    /**
155
     * @param string $message
156
     */
157
    public function setMessage($message)
158
    {
159
        $this->message = $message;
160
    }
161
162
    /**
163
     * @return UriAwareResponse
164
     */
165
    public function getResponse()
166
    {
167
        return $this->response;
168
    }
169
170
    /**
171
     * @param ResponseInterface $response
172
     */
173
    public function setResponse(ResponseInterface $response)
174
    {
175
        $this->response = $response;
0 ignored issues
show
Documentation Bug introduced by
$response is of type object<Psr\Http\Message\ResponseInterface>, but the property $response was declared to be of type object<phm\HttpWebdriver...ponse\UriAwareResponse>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
176
    }
177
178
    /**
179
     * @return mixed
180
     */
181
    public function getRuleName()
182
    {
183
        return $this->ruleName;
184
    }
185
186
    /**
187
     * @param mixed $ruleName
188
     */
189
    public function setRuleName($ruleName)
190
    {
191
        $this->ruleName = $ruleName;
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getUrl()
198
    {
199
        return $this->url;
200
    }
201
}
202