Issues (3)

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/Psr15ToSymfonyBridge.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
namespace TheCodingMachine\Psr15Bridge;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Server\MiddlewareInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
10
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
11
use Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
12
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
13
use Symfony\Component\HttpKernel\HttpKernelInterface;
14
15
/**
16
 * A psr15 middleware that can be used to access Symfony middlewares.
17
 *
18
 * Note: Symfony middlewares do not have the notion of "next" middleware built-in, so the wrapped middleware will
19
 * ALWAYS return a response and NEVER pass the request to the "next" middleware.
20
 */
21
class Psr15ToSymfonyBridge implements MiddlewareInterface, RequestHandlerInterface
22
{
23
    /**
24
     * @var HttpKernelInterface
25
     */
26
    private $symfonyMiddleware;
27
    /**
28
     * @var HttpMessageFactoryInterface
29
     */
30
    private $httpMessageFactory;
31
    /**
32
     * @var HttpFoundationFactoryInterface
33
     */
34
    private $httpFoundationFactory;
35
36
    /**
37
     * @param HttpKernelInterface            $symfonyMiddleware     The next Symfony middleware to be called (after the psr15 middleware.
38
     * @param HttpFoundationFactoryInterface $httpFoundationFactory The class in charge of translating PSR-7 request/response objects to Symfony objects. Defaults to Symfony default implementation
39
     * @param HttpMessageFactoryInterface    $httpMessageFactory    The class in charge of translating Symfony request/response objects to PSR-7 objects. Defaults to Symfony default implementation (that uses Diactoros)
40
     */
41
    public function __construct(HttpKernelInterface $symfonyMiddleware, HttpFoundationFactoryInterface $httpFoundationFactory = null, HttpMessageFactoryInterface $httpMessageFactory = null)
42
    {
43
        $this->symfonyMiddleware = $symfonyMiddleware;
44
        $this->httpFoundationFactory = $httpFoundationFactory ?: new HttpFoundationFactory();
45
        $this->httpMessageFactory = $httpMessageFactory ?: new DiactorosFactory();
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bridge\PsrHttpMe...actory\DiactorosFactory has been deprecated with message: since symfony/psr-http-message-bridge 1.2, use PsrHttpFactory instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
46
    }
47
48
    /**
49
     * Process an incoming server request and return a response, optionally delegating
50
     * to the next middleware component to create the response.
51
     *
52
     * @param ServerRequestInterface $request
53
     * @param RequestHandlerInterface|null $delegate
54
     *
55
     * @return ResponseInterface
56
     */
57
    public function process(ServerRequestInterface $request, RequestHandlerInterface $delegate): ResponseInterface
58
    {
59
        return $this->handle($request);
60
    }
61
62
    /**
63
     * Handle the request and return a response.
64
     */
65
    public function handle(ServerRequestInterface $request): ResponseInterface
66
    {
67
        $symfonyRequest = $this->httpFoundationFactory->createRequest($request);
68
69
        $symfonyResponse = $this->symfonyMiddleware->handle($symfonyRequest);
70
71
        return $this->httpMessageFactory->createResponse($symfonyResponse);
72
    }
73
}
74