Issues (245)

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/Entities/Assertions/BasicAssertion.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
3
/**
4
 * \AppserverIo\Doppelgaenger\Entities\Assertions\BasicAssertion
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Bernhard Wick <[email protected]>
15
 * @copyright 2015 TechDivision GmbH - <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/doppelgaenger
18
 * @link      http://www.appserver.io/
19
 */
20
21
namespace AppserverIo\Doppelgaenger\Entities\Assertions;
22
23
/**
24
 * Basic assertions to compare two values
25
 *
26
 * @author    Bernhard Wick <[email protected]>
27
 * @copyright 2015 TechDivision GmbH - <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/appserver-io/doppelgaenger
30
 * @link      http://www.appserver.io/
31
 */
32
class BasicAssertion extends AbstractAssertion
33
{
34
    /**
35
     * @var string $firstOperand The first operand to compare
36
     */
37
    public $firstOperand;
38
39
    /**
40
     * @var string $secondOperand The second operand to compare
41
     */
42
    public $secondOperand;
43
44
    /**
45
     * @var string $operator The operator used for comparison
46
     */
47
    public $operator;
48
49
    /**
50
     * @var array $inversionMapping A map to inverse operators
51
     */
52
    protected $inversionMapping;
53
54
    /**
55
     * Default constructor
56
     *
57
     * @param string $firstOperand  The first operand to compare
58
     * @param string $secondOperand The second operand to compare
59
     * @param string $operator      The operator used for comparison
60
     */
61
    public function __construct($firstOperand = '', $secondOperand = '', $operator = '')
62
    {
63
        $this->firstOperand = $firstOperand;
64
        $this->secondOperand = $secondOperand;
65
        $this->operator = $operator;
66
67
        // Set the mapping for our inversion
68
        $this->inversionMapping = array(
69
            '==' => '!=',
70
            '===' => '!==',
71
            '<>' => '==',
72
            '<' => '>=',
73
            '>' => '<=',
74
            '<=' => '>',
75
            '>=' => '<',
76
            '!=' => '==',
77
            '!==' => '==='
78
        );
79
80
        parent::__construct();
81
    }
82
83
    /**
84
     * Will return a string representation of this assertion
85
     *
86
     * @return string
87
     */
88
    public function getString()
89
    {
90
        return (string)$this->firstOperand . ' ' . $this->operator . ' ' . $this->secondOperand;
91
    }
92
93
    /**
94
     * Will return an inverted string representation.
95
     * Implemented here, as we want to check if there is an entry in our inversion map we can use
96
     *
97
     * @return string
98
     */
99
    public function getInvertString()
100
    {
101
        if (isset($this->inversionMapping[$this->operator])) {
102
            // only return if we found something
103
            return (string)$this->firstOperand . ' ' .
104
            $this->inversionMapping[$this->operator] . ' ' . $this->secondOperand;
105
        }
106
    }
107
108
    /**
109
     * Invert the logical meaning of this assertion
110
     *
111
     * @return bool
112
     */
113
    public function invert()
114
    {
115
        if (isset($this->inversionMapping[$this->operator])) {
116
            // Invert the operator
117
            $this->operator = $this->inversionMapping[$this->operator];
118
            // Don't forget to mark this assertion as inverted
119 View Code Duplication
            if ($this->inverted === true) {
120
                $this->inverted = false;
121
0 ignored issues
show
Blank line found at end of control structure
Loading history...
122
            } else {
123
                $this->inverted = true;
124
            }
125
126
            return true;
127
0 ignored issues
show
Blank line found at end of control structure
Loading history...
128
        } else {
129
            return false;
130
        }
131
    }
132
}
133