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/Pointcuts/PointcutPointcut.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
/**
4
 * \AppserverIo\Doppelgaenger\Entities\Pointcut\PointcutPointcut
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\Pointcuts;
22
23
use AppserverIo\Doppelgaenger\Entities\Definitions\FunctionDefinition;
24
25
/**
26
 * Pointcut expression for specifying a collection of other pointcuts and annotations expressing them
27
 *
28
 * @author    Bernhard Wick <[email protected]>
29
 * @copyright 2015 TechDivision GmbH - <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/appserver-io/doppelgaenger
32
 * @link      http://www.appserver.io/
33
 *
34
 * @Target({"ADVICE"})
35
 */
36
class PointcutPointcut extends AbstractPointcut
37
{
38
39
    /**
40
     * Connector for referencing of several pointcuts at once
41
     *
42
     * @var string EXPRESSION_CONNECTOR
43
     */
44
    const EXPRESSION_CONNECTOR = ',';
45
46
    /**
47
     * Whether or not the pointcut is considered static, meaning is has to be weaved and evaluated during runtime
48
     * anyway
49
     *
50
     * @var boolean IS_STATIC
51
     */
52
    const IS_STATIC = false;
53
54
    /**
55
     * The type of this pointcut
56
     *
57
     * @var string TYPE
58
     */
59
    const TYPE = 'pointcut';
60
61
    /**
62
     * Pointcuts referenced by this pointcut's expression
63
     *
64
     * @var \AppserverIo\Doppelgaenger\Interfaces\PointcutInterface[] $referencedPointcuts
65
     */
66
    protected $referencedPointcuts;
67
68
    /**
69
     * Magic __clone method to allow for deep clones of pointcut instances
70
     *
71
     * @return void
72
     */
73
    public function __clone()
74
    {
75
        foreach ($this->referencedPointcuts as $key => $referencedPointcut) {
76
            $this->referencedPointcuts[$key] = clone $referencedPointcut;
77
        }
78
    }
79
80
    /**
81
     * Returns a string representing a boolean condition which can be used to determine if
82
     * the pointcut has to be executed
83
     *
84
     * @return string
85
     */
86
    public function getConditionString()
87
    {
88
        return 'true';
89
    }
90
91
    /**
92
     * Returns a string representing the actual execution of the pointcut logic
93
     *
94
     * @param string|null $assignTo Should the result be assigned and stored for later use? If so, to what?
95
     *
96
     * @return string
97
     */
98
    public function getExecutionString($assignTo = null)
99
    {
100
        return '';
101
    }
102
103
    /**
104
     * Getter for the $referencedPointcuts property
105
     *
106
     * @return array
107
     */
108
    public function getReferencedPointcuts()
109
    {
110
        return $this->referencedPointcuts;
111
    }
112
113
    /**
114
     * Whether or not the pointcut matches a given candidate.
115
     * Weave pointcuts will always return true, as they do not pose any condition
116
     *
117
     * @param mixed $candidate Candidate to match against the pointcuts match pattern (getMatchPattern())
118
     *
119
     * @return boolean
120
     */
121
    public function matches($candidate)
122
    {
123
        // if we do not get a function definition we can already assume there is no match
124
        if (!$candidate instanceof FunctionDefinition) {
125
            return false;
126
        }
127
128
        // iterate all referenced pointcuts and return true if one of them matches
129
        foreach ($this->referencedPointcuts as $referencedPointcut) {
130
            if ($referencedPointcut->pointcutExpression->getPointcut()->matches($candidate)) {
0 ignored issues
show
Accessing pointcutExpression on the interface AppserverIo\Doppelgaenge...faces\PointcutInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
131
                return true;
132
            }
133
        }
134
135
        return false;
136
    }
137
138
    /**
139
     * Setter for the $referencedPointcuts property
140
     *
141
     * @param \AppserverIo\Doppelgaenger\Interfaces\PointcutInterface[] $referencedPointcuts Pointcuts referenced by this pointcut's expression
142
     *
143
     * @return null
144
     */
145
    public function setReferencedPointcuts(array $referencedPointcuts)
146
    {
147
        $this->referencedPointcuts = $referencedPointcuts;
148
    }
149
}
150