Issues (14)

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/Psr17FactoryDiscovery.php (6 issues)

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
namespace Http\Discovery;
4
5
use Http\Discovery\Exception\DiscoveryFailedException;
6
use Psr\Http\Message\RequestFactoryInterface;
7
use Psr\Http\Message\ResponseFactoryInterface;
8
use Psr\Http\Message\ServerRequestFactoryInterface;
9
use Psr\Http\Message\StreamFactoryInterface;
10
use Psr\Http\Message\UploadedFileFactoryInterface;
11
use Psr\Http\Message\UriFactoryInterface;
12
13
/**
14
 * Finds PSR-17 factories.
15
 *
16
 * @author Tobias Nyholm <[email protected]>
17
 */
18
final class Psr17FactoryDiscovery extends ClassDiscovery
19
{
20
    private static function createException($type, Exception $e)
21
    {
22
        return new \Http\Discovery\Exception\NotFoundException(
23
            'No PSR-17 '.$type.' found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation',
24
            0,
25
            $e
26
        );
27
    }
28
29
    /**
30
     * @return RequestFactoryInterface
31
     *
32
     * @throws Exception\NotFoundException
33
     */
34 View Code Duplication
    public static function findRequestFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
    {
36
        try {
37
            $messageFactory = static::findOneByType(RequestFactoryInterface::class);
38
        } catch (DiscoveryFailedException $e) {
39
            throw self::createException('request factory', $e);
40
        }
41
42
        return static::instantiateClass($messageFactory);
43
    }
44
45
    /**
46
     * @return ResponseFactoryInterface
47
     *
48
     * @throws Exception\NotFoundException
49
     */
50 View Code Duplication
    public static function findResponseFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        try {
53
            $messageFactory = static::findOneByType(ResponseFactoryInterface::class);
54
        } catch (DiscoveryFailedException $e) {
55
            throw self::createException('response factory', $e);
56
        }
57
58
        return static::instantiateClass($messageFactory);
59
    }
60
61
    /**
62
     * @return ServerRequestFactoryInterface
63
     *
64
     * @throws Exception\NotFoundException
65
     */
66 View Code Duplication
    public static function findServerRequestFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        try {
69
            $messageFactory = static::findOneByType(ServerRequestFactoryInterface::class);
70
        } catch (DiscoveryFailedException $e) {
71
            throw self::createException('server request factory', $e);
72
        }
73
74
        return static::instantiateClass($messageFactory);
75
    }
76
77
    /**
78
     * @return StreamFactoryInterface
79
     *
80
     * @throws Exception\NotFoundException
81
     */
82 View Code Duplication
    public static function findStreamFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
83
    {
84
        try {
85
            $messageFactory = static::findOneByType(StreamFactoryInterface::class);
86
        } catch (DiscoveryFailedException $e) {
87
            throw self::createException('stream factory', $e);
88
        }
89
90
        return static::instantiateClass($messageFactory);
91
    }
92
93
    /**
94
     * @return UploadedFileFactoryInterface
95
     *
96
     * @throws Exception\NotFoundException
97
     */
98 View Code Duplication
    public static function findUploadedFileFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
99
    {
100
        try {
101
            $messageFactory = static::findOneByType(UploadedFileFactoryInterface::class);
102
        } catch (DiscoveryFailedException $e) {
103
            throw self::createException('uploaded file factory', $e);
104
        }
105
106
        return static::instantiateClass($messageFactory);
107
    }
108
109
    /**
110
     * @return UriFactoryInterface
111
     *
112
     * @throws Exception\NotFoundException
113
     */
114 View Code Duplication
    public static function findUriFactory()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
115
    {
116
        try {
117
            $messageFactory = static::findOneByType(UriFactoryInterface::class);
118
        } catch (DiscoveryFailedException $e) {
119
            throw self::createException('url factory', $e);
120
        }
121
122
        return static::instantiateClass($messageFactory);
123
    }
124
125
    /**
126
     * @return UriFactoryInterface
127
     *
128
     * @throws Exception\NotFoundException
129
     *
130
     * @deprecated This will be removed in 2.0. Consider using the findUriFactory() method.
131
     */
132
    public static function findUrlFactory()
133
    {
134
        return static::findUriFactory();
135
    }
136
}
137