Issues (87)

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.

Aop/Framework/ReflectionConstructorInvocation.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
declare(strict_types=1);
4
/*
5
 * Go! AOP framework
6
 *
7
 * @copyright Copyright 2011, Lisachenko Alexander <[email protected]>
8
 *
9
 * This source file is subject to the license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Go\Aop\Framework;
14
15
use Go\Aop\Intercept\ConstructorInvocation;
16
use Go\Core\AspectContainer;
17
use ReflectionClass;
18
use ReflectionMethod;
19
20
/**
21
 * Reflection constructor invocation implementation
22
 */
23
class ReflectionConstructorInvocation extends AbstractInvocation implements ConstructorInvocation
24
{
25
    /**
26
     * Reflection class
27
     */
28
    protected ReflectionClass $class;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
29
30
    /**
31
     * Instance of created class, can be used for Around or After types of advices.
32
     */
33
    protected ?object $instance = null;
34
35
    /**
36
     * Instance of reflection constructor for class (if present)
37
     */
38
    private ?ReflectionMethod $constructor;
39
40
    /**
41
     * Constructor for constructor invocation :)
42
     *
43
     * @param array $advices List of advices for this invocation
44
     */
45
    public function __construct(array $advices, string $className)
46
    {
47
        $originalClass = $className;
48
        if (strpos($originalClass, AspectContainer::AOP_PROXIED_SUFFIX) !== false) {
49 1
            $originalClass = substr($originalClass, 0, -strlen(AspectContainer::AOP_PROXIED_SUFFIX));
50
        }
51 1
52 1
        $this->class       = new ReflectionClass($originalClass);
53
        $this->constructor = $constructor = $this->class->getConstructor();
54
55 1
        // Give an access to call protected/private constructors
56
        if ($constructor !== null && !$constructor->isPublic()) {
57
            $constructor->setAccessible(true);
58
        }
59 1
60 1
        parent::__construct($advices);
61
    }
62
63
    /**
64
     * Proceed to the next interceptor in the Chain
65
     *
66
     * Typically this method is called inside previous closure, as instance of Joinpoint is passed to callback
67
     * Do not call this method directly, only inside callback closures.
68
     *
69
     * @return object Covariant, always new object.
70
     */
71
    final public function proceed(): object
72
    {
73
        if (isset($this->advices[$this->current])) {
74
            $currentInterceptor = $this->advices[$this->current];
75
            $this->current++;
76
77
            return $currentInterceptor->invoke($this);
78
        }
79
80
        $this->instance = $this->class->newInstanceWithoutConstructor();
81
        $constructor    = $this->getConstructor();
82
        if ($constructor !== null) {
83
            $constructor->invoke($this->instance, ...$this->arguments);
84
        }
85
86
        return $this->instance;
87
    }
88
89
    /**
90
     * Gets the constructor being called or null if it is absent.
91
     */
92
    public function getConstructor(): ?ReflectionMethod
93
    {
94
        return $this->constructor;
95
    }
96
97
    /**
98
     * Returns the object for which current joinpoint is invoked
99
     *
100
     * @return object|null Instance of object or null if object hasn't been created yet (Before)
101
     */
102
    public function getThis(): ?object
103
    {
104
        return $this->instance;
105
    }
106
107
    /**
108
     * Invokes current constructor invocation with all interceptors
109
     */
110
    final public function __invoke(array $arguments = []): object
111
    {
112
        $this->current   = 0;
113
        $this->arguments = $arguments;
114
115
        return $this->proceed();
116
    }
117
118
    /**
119
     * Checks if the current joinpoint is dynamic or static
120
     *
121
     * Dynamic joinpoint contains a reference to an object that can be received via getThis() method call
122
     *
123
     * @see ClassJoinpoint::getThis()
124
     */
125
    public function isDynamic(): bool
126
    {
127
        return true;
128
    }
129
130
    /**
131
     * Returns the static scope name (class name) of this joinpoint.
132
     */
133
    public function getScope(): string
134
    {
135
        return $this->class->getName();
136
    }
137
138
    /**
139
     * Returns a friendly description of current joinpoint
140
     */
141
    final public function __toString(): string
142
    {
143
        return sprintf(
144
            'initialization(%s)',
145
            $this->getScope()
146
        );
147
    }
148
}
149