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/PointcutExpression.php (1 issue)

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\PointcutExpression
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;
22
23
use AppserverIo\Doppelgaenger\Dictionaries\ReservedKeywords;
24
use AppserverIo\Doppelgaenger\Entities\Pointcuts\PointcutFactory;
25
use AppserverIo\Doppelgaenger\Interfaces\CodifyableInterface;
26
use AppserverIo\Psr\MetaobjectProtocol\Aop\Annotations\Advices\Around;
27
28
/**
29
 * Definition of a pointcut as a combination of a joinpoint and advices
30
 *
31
 * @author    Bernhard Wick <[email protected]>
32
 * @copyright 2015 TechDivision GmbH - <[email protected]>
33
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
 * @link      https://github.com/appserver-io/doppelgaenger
35
 * @link      http://www.appserver.io/
36
 *
37
 * @see        https://www.eclipse.org/aspectj/doc/next/progguide/quick.html
38
 * @see        https://www.eclipse.org/aspectj/doc/next/progguide/semantics-pointcuts.html
39
 */
40
class PointcutExpression implements CodifyableInterface
41
{
42
43
    /**
44
     * Joinpoint at which the enclosed advices have to be weaved
45
     *
46
     * @var \AppserverIo\Doppelgaenger\Entities\Joinpoint|null $joinpoint
47
     */
48
    protected $joinpoint;
49
50
    /**
51
     * Pointcut(tree) representing the logical structure of the given string expression
52
     *
53
     * @var \AppserverIo\Doppelgaenger\Interfaces\PointcutInterface $pointcut
54
     */
55
    protected $pointcut;
56
57
    /**
58
     * Original string definition of the pointcut
59
     *
60
     * @var string $string
61
     */
62
    protected $string;
63
64
    /**
65
     * Default constructor
66
     *
67
     * @param string $rawString Raw string the pointcuts expressions can be filtered from
68
     */
69
    public function __construct($rawString)
70
    {
71
        $this->joinpoint = null;
72
        $this->string = $rawString;
73
74
        $pointcutFactory = new PointcutFactory();
75
        $this->pointcut = $pointcutFactory->getInstance($rawString);
76
    }
77
78
    /**
79
     * Getter for the $joinpoints property
80
     *
81
     * @return \AppserverIo\Doppelgaenger\Entities\Joinpoint|null
82
     */
83
    public function getJoinpoint()
84
    {
85
        return $this->joinpoint;
86
    }
87
88
    /**
89
     * Getter for the $pointcut property
90
     *
91
     * @return \AppserverIo\Doppelgaenger\Interfaces\PointcutInterface
92
     */
93
    public function getPointcut()
94
    {
95
        return $this->pointcut;
96
    }
97
98
    /**
99
     * Getter for the $string property
100
     *
101
     * @return string
102
     */
103
    public function getString()
104
    {
105
        return $this->string;
106
    }
107
108
    /**
109
     * Setter for the $joinpoints property
110
     *
111
     * @param \AppserverIo\Doppelgaenger\Entities\Joinpoint $joinpoint Joinpoint instance to set
112
     *
113
     * @return null
114
     */
115
    public function setJoinpoint(Joinpoint $joinpoint)
116
    {
117
        $this->joinpoint = $joinpoint;
118
    }
119
120
    /**
121
     * Setter for the $pointcut property
122
     *
123
     * @param \AppserverIo\Doppelgaenger\Interfaces\PointcutInterface $pointcut Pointcut of this expression
124
     *
125
     * @return null
126
     */
127
    public function setPointcut($pointcut)
128
    {
129
        $this->pointcut = $pointcut;
130
    }
131
132
    /**
133
     * Setter for the $string property
134
     *
135
     * @param string $string Expression string
136
     *
137
     * @return null
138
     */
139
    public function setString($string)
140
    {
141
        $this->string = $string;
142
    }
143
144
    /**
145
     * Return a string representation of the logic behind pointcut expression
146
     *
147
     * @return string
148
     */
149
    public function toCode()
150
    {
151
        // around advices need to have their result saved
152
        $assignTo = null;
153
        if (!is_null($this->getJoinpoint()) && $this->getJoinpoint()->getCodeHook() === Around::ANNOTATION) {
154
            $assignTo = ReservedKeywords::RESULT;
155
        }
156
157
        // do we even have an useful condition?
158
        $condition = $this->getPointcut()->getConditionString();
159
        if ($condition === 'true' || empty($condition)) {
160
            return $this->getPointcut()->getExecutionString($assignTo);
161
0 ignored issues
show
Blank line found at end of control structure
Loading history...
162
        } else {
163
            return 'if (' . $condition .') {
164
            ' . $this->getPointcut()->getExecutionString($assignTo) . '
165
            }';
166
        }
167
    }
168
}
169