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.

src/Aop/Framework/AbstractJoinpoint.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\Advice;
16
use Go\Aop\AdviceAfter;
17
use Go\Aop\AdviceAround;
18
use Go\Aop\AdviceBefore;
19
use Go\Aop\Intercept\Interceptor;
20
use Go\Aop\Intercept\Joinpoint;
21
22
use function is_array;
23
24
/**
25
 *  Abstract joinpoint for framework
26
 *
27
 * Join points are points in the execution of the system, such as method calls,
28
 * where behavior supplied by aspects is combined. A join point is a point in
29
 * the execution of the program, which is used to define the dynamic structure
30
 * of a crosscutting concern.
31
 *
32
 * @link http://en.wikipedia.org/wiki/Aspect-oriented_software_development#Join_point_model
33
 */
34
abstract class AbstractJoinpoint implements Joinpoint
35
{
36
    /**
37
     * List of advices (interceptors)
38
     *
39
     * NB: All current children assume that each advice is Interceptor now.
40
     * Whereas, it isn't correct logically, this can be used to satisfy PHPStan check now.
41
     *
42
     * @var array<Interceptor>
43
     */
44
    protected array $advices = [];
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_ARRAY, expecting T_FUNCTION or T_CONST
Loading history...
45
46
    /**
47
     * Current advice index
48
     */
49
    protected int $current = 0;
50
51
    /**
52
     * Stack frames to work with recursive calls or with cross-calls inside object
53
     */
54
    protected array $stackFrames = [];
55
56
    /**
57
     * Recursion level for invocation
58
     */
59
    protected int $level = 0;
60
61
    /**
62
     * Initializes list of advices for current joinpoint
63
     *
64
     * @param array<Interceptor> $advices List of advices (interceptors)
65
     */
66
    public function __construct(array $advices)
67 27
    {
68
        $this->advices = $advices;
69 27
    }
70 27
71
    /**
72
     * Sorts advices by priority
73
     *
74
     * @param array<Advice|Interceptor> $advices
75
     *
76
     * @return array<Advice|Interceptor> Sorted list of advices
77
     */
78 14
    public static function sortAdvices(array $advices): array
79
    {
80 14
        $sortedAdvices = $advices;
81
        uasort(
82
            $sortedAdvices,
83 9
            function (Advice $first, Advice $second) {
84 4
                switch (true) {
85
                    case $first instanceof AdviceBefore && !($second instanceof AdviceBefore):
86 6
                        return -1;
87 3
88
                    case $first instanceof AdviceAround && !($second instanceof AdviceAround):
89 4
                        return 1;
90 2
91
                    case $first instanceof AdviceAfter && !($second instanceof AdviceAfter):
92 2
                        return $second instanceof AdviceBefore ? 1 : -1;
93 1
94
                    case ($first instanceof OrderedAdvice && $second instanceof OrderedAdvice):
95
                        return $first->getAdviceOrder() - $second->getAdviceOrder();
96 1
97
                    default:
98 14
                        return 0;
99
                }
100 14
            }
101
        );
102
103
        return $sortedAdvices;
104
    }
105
106
    /**
107
     * Replace concrete advices with list of ids
108 6
     *
109
     * @param Advice[][][] $advices List of advices
110 6
     */
111 6
    public static function flatAndSortAdvices(array $advices): array
112 6
    {
113 6
        $flattenAdvices = [];
114 6
        foreach ($advices as $type => $typedAdvices) {
115
            foreach ($typedAdvices as $name => $concreteAdvices) {
116
                $flattenAdvices[$type][$name] = array_keys(self::sortAdvices($concreteAdvices));
117
            }
118
        }
119
120
        return $flattenAdvices;
121 6
    }
122
}
123