Issues (1446)

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.

LazyLoadingGhostInstantiationBench.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
declare(strict_types=1);
4
5
namespace ProxyManagerBench;
6
7
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
8
use ProxyManager\Generator\ClassGenerator;
9
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
10
use ProxyManager\ProxyGenerator\LazyLoadingGhostGenerator;
11
use ProxyManagerTestAsset\ClassWithMixedProperties;
12
use ProxyManagerTestAsset\ClassWithPrivateProperties;
13
use ProxyManagerTestAsset\ClassWithProtectedProperties;
14
use ProxyManagerTestAsset\ClassWithPublicProperties;
15
use ProxyManagerTestAsset\EmptyClass;
16
use ReflectionClass;
17
use function assert;
18
use function class_exists;
19
use function is_a;
20
21
/**
22
 * Benchmark that provides results for simple object instantiation for lazy loading ghost proxies
23
 *
24
 * @BeforeMethods({"setUp"})
25
 */
26
final class LazyLoadingGhostInstantiationBench
27
{
28
    /** @psalm-var class-string<EmptyClass> */
29
    private string $emptyClassProxy;
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...
30
    /** @psalm-var class-string<ClassWithPrivateProperties> */
31
    private string $privatePropertiesProxy;
32
    /** @psalm-var class-string<ClassWithProtectedProperties> */
33
    private string $protectedPropertiesProxy;
34
    /** @psalm-var class-string<ClassWithPublicProperties> */
35
    private string $publicPropertiesProxy;
36
    /** @psalm-var class-string<ClassWithMixedProperties> */
37
    private string $mixedPropertiesProxy;
38
39
    public function setUp() : void
40
    {
41
        $this->emptyClassProxy          = $this->generateProxy(EmptyClass::class);
42
        $this->privatePropertiesProxy   = $this->generateProxy(ClassWithPrivateProperties::class);
43
        $this->protectedPropertiesProxy = $this->generateProxy(ClassWithProtectedProperties::class);
44
        $this->publicPropertiesProxy    = $this->generateProxy(ClassWithPublicProperties::class);
45
        $this->mixedPropertiesProxy     = $this->generateProxy(ClassWithMixedProperties::class);
46
    }
47
48
    public function benchOriginalConstructorInstantiationOfEmptyObject() : void
49
    {
50
        new $this->emptyClassProxy();
51
    }
52
53
    public function benchInstantiationOfEmptyObject() : void
54
    {
55
        /** @psalm-suppress UndefinedMethod */
56
        $this->emptyClassProxy::staticProxyConstructor(static function () : void {
57
        });
58
    }
59
60
    public function benchOriginalConstructorInstantiationOfObjectWithPrivateProperties() : void
61
    {
62
        new $this->privatePropertiesProxy();
63
    }
64
65
    public function benchInstantiationOfObjectWithPrivateProperties() : void
66
    {
67
        /** @psalm-suppress UndefinedMethod */
68
        $this->privatePropertiesProxy::staticProxyConstructor(static function () : void {
69
        });
70
    }
71
72
    public function benchOriginalConstructorInstantiationOfObjectWithProtectedProperties() : void
73
    {
74
        new $this->protectedPropertiesProxy();
75
    }
76
77
    public function benchInstantiationOfObjectWithProtectedProperties() : void
78
    {
79
        /** @psalm-suppress UndefinedMethod */
80
        $this->protectedPropertiesProxy::staticProxyConstructor(static function () : void {
81
        });
82
    }
83
84
    public function benchOriginalConstructorInstantiationOfObjectWithPublicProperties() : void
85
    {
86
        new $this->publicPropertiesProxy();
87
    }
88
89
    public function benchInstantiationOfObjectWithPublicProperties() : void
90
    {
91
        /** @psalm-suppress UndefinedMethod */
92
        $this->publicPropertiesProxy::staticProxyConstructor(static function () : void {
93
        });
94
    }
95
96
    public function benchOriginalConstructorInstantiationOfObjectWithMixedProperties() : void
97
    {
98
        new $this->mixedPropertiesProxy();
99
    }
100
101
    public function benchInstantiationOfObjectWithMixedProperties() : void
102
    {
103
        /** @psalm-suppress UndefinedMethod */
104
        $this->mixedPropertiesProxy::staticProxyConstructor(static function () : void {
105
        });
106
    }
107
108
    /**
109
     * @psalm-template OriginalClass
110
     * @psalm-param class-string<OriginalClass> $originalClass
111
     * @psalm-return class-string<OriginalClass>
112
     * @psalm-suppress MoreSpecificReturnType
113
     */
114
    private function generateProxy(string $originalClass) : string
115
    {
116
        $generatedClassName = self::class . '\\' . $originalClass;
117
118
        if (class_exists($generatedClassName)) {
119
            assert(is_a($generatedClassName, $originalClass, true));
120
121
            return $generatedClassName;
122
        }
123
124
        $generatedClass = new ClassGenerator($generatedClassName);
125
126
        (new LazyLoadingGhostGenerator())->generate(new ReflectionClass($originalClass), $generatedClass, []);
127
        (new EvaluatingGeneratorStrategy())->generate($generatedClass);
128
129
        /** @psalm-suppress LessSpecificReturnStatement */
130
        return $generatedClassName;
131
    }
132
}
133