Issues (28)

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/Interfaces/Assert/ObjectAssertTrait.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
namespace Peridot\Leo\Interfaces\Assert;
4
5
/**
6
 * ObjectAssertTrait contains assertions that deal
7
 * primarily with objects.
8
 *
9
 * @package Peridot\Leo\Interfaces\Assert
10
 */
11
trait ObjectAssertTrait
12
{
13
    /**
14
     * Perform an instanceof assertion.
15
     *
16
     * @param object $object
17
     * @param string $class
18
     * @param string $message
19
     */
20
    public function isInstanceOf($object, $class, $message = '')
21
    {
22
        $this->assertion->setActual($object);
0 ignored issues
show
The property assertion does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
23
24
        return $this->assertion->is->instanceof($class, $message);
25
    }
26
27
    /**
28
     * Perform a negated instanceof assertion.
29
     *
30
     * @param object $object
31
     * @param string $class
32
     * @param string $message
33
     */
34
    public function notInstanceOf($object, $class, $message = '')
35
    {
36
        $this->assertion->setActual($object);
37
38
        return $this->assertion->is->not->instanceof($class, $message);
39
    }
40
41
    /**
42
     * Perform a property assertion.
43
     *
44
     * @param array|object $object
45
     * @param string       $property
46
     * @param string       $message
47
     */
48
    public function property($object, $property, $message = '')
49
    {
50
        $this->assertion->setActual($object);
51
52
        return $this->assertion->to->have->property($property, null, $message);
53
    }
54
55
    /**
56
     * Perform a negated property assertion.
57
     *
58
     * @param array|object $object
59
     * @param string       $property
60
     * @param string       $message
61
     */
62
    public function notProperty($object, $property, $message = '')
63
    {
64
        $this->assertion->setActual($object);
65
66
        return $this->assertion->to->not->have->property($property, null, $message);
67
    }
68
69
    /**
70
     * Perform a deep property assertion.
71
     *
72
     * @param array|object $object
73
     * @param string       $property
74
     * @param string       $message
75
     */
76
    public function deepProperty($object, $property, $message = '')
77
    {
78
        $this->assertion->setActual($object);
79
80
        return $this->assertion->to->have->deep->property($property, null, $message);
81
    }
82
83
    /**
84
     * Perform a negated deep property assertion.
85
     *
86
     * @param array|object $object
87
     * @param string       $property
88
     * @param string       $message
89
     */
90
    public function notDeepProperty($object, $property, $message = '')
91
    {
92
        $this->assertion->setActual($object);
93
94
        return $this->assertion->to->not->have->deep->property($property, null, $message);
95
    }
96
97
    /**
98
     * Perform a property value assertion.
99
     *
100
     * @param array|object $object
101
     * @param string       $property
102
     * @param mixed        $value
103
     * @param string       $message
104
     */
105
    public function propertyVal($object, $property, $value, $message = '')
106
    {
107
        $this->assertion->setActual($object);
108
109
        return $this->assertion->to->have->property($property, $value, $message);
110
    }
111
112
    /**
113
     * Perform a negated property value assertion.
114
     *
115
     * @param array|object $object
116
     * @param string       $property
117
     * @param mixed        $value
118
     * @param string       $message
119
     */
120
    public function propertyNotVal($object, $property, $value, $message = '')
121
    {
122
        $this->assertion->setActual($object);
123
124
        return $this->assertion->to->not->have->property($property, $value, $message);
125
    }
126
127
    /**
128
     * Perform a deep property value assertion.
129
     *
130
     * @param array|object $object
131
     * @param string       $property
132
     * @param mixed        $value
133
     * @param string       $message
134
     */
135
    public function deepPropertyVal($object, $property, $value, $message = '')
136
    {
137
        $this->assertion->setActual($object);
138
139
        return $this->assertion->to->have->deep->property($property, $value, $message);
140
    }
141
142
    /**
143
     * Perform a negated deep property value assertion.
144
     *
145
     * @param array|object $object
146
     * @param string       $property
147
     * @param mixed        $value
148
     * @param string       $message
149
     */
150
    public function deepPropertyNotVal($object, $property, $value, $message = '')
151
    {
152
        $this->assertion->setActual($object);
153
154
        return $this->assertion->to->not->have->deep->property($property, $value, $message);
155
    }
156
}
157