Issues (5)

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.

test/DependencyInjection/TestContainerBuilder.php (3 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
declare(strict_types = 1);
4
5
namespace TomCizek\AsynchronousRouter\Tests\DependencyInjection;
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBuilder;
9
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
10
use Symfony\Component\DependencyInjection\Loader\FileLoader;
11
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
12
13
class TestContainerBuilder
14
{
15
    /** @var FileLoader */
16
    private $fileLoaderFactory;
17
18
    /** @var string */
19
    private $fileExtension;
20
21
    /** @var array[] */
22
    private $parameters;
23
24
    /** @var ExtensionInterface[] */
25
    private $extensions = [];
26
27
    /** @var CompilerPassInterface[] */
28
    private $compilerPasses = [];
29
30
    /** @var string[] */
31
    private $configFiles = [];
32
33
    public static function buildContainer(callable $fileLoaderFactory, string $fileExtension): self
34
    {
35
        return new self($fileLoaderFactory, $fileExtension);
36
    }
37
38
    private function __construct(callable $fileLoaderFactory, string $fileExtension)
39
    {
40
        $this->fileLoaderFactory = $fileLoaderFactory;
0 ignored issues
show
Documentation Bug introduced by
It seems like $fileLoaderFactory of type callable is incompatible with the declared type object<Symfony\Component...tion\Loader\FileLoader> of property $fileLoaderFactory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
41
        $this->fileExtension = $fileExtension;
42
        $this->parameters = [
0 ignored issues
show
Documentation Bug introduced by
It seems like array('kernel.debug' => ...__DIR__ . '/../../src') of type array<string,false|array...el.root_dir":"string"}> is incompatible with the declared type array<integer,array> of property $parameters.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
43
            'kernel.debug' => false,
44
            'kernel.bundles' => [],
45
            'kernel.cache_dir' => sys_get_temp_dir(),
46
            'kernel.environment' => 'test',
47
            'kernel.root_dir' => __DIR__ . '/../../src',
48
        ];
49
    }
50
51
    public function withParameters(array $parameters): self
52
    {
53
        $this->parameters = array_merge($this->parameters, $parameters);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_merge($this->parameters, $parameters) of type array is incompatible with the declared type array<integer,array> of property $parameters.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
54
55
        return $this;
56
    }
57
58
    public function withExtensions(ExtensionInterface ...$extensions): self
59
    {
60
        $this->extensions = array_merge($this->extensions, $extensions);
61
62
        return $this;
63
    }
64
65
    public function withCompilerPasses(CompilerPassInterface ...$compilerPasses): self
66
    {
67
        $this->compilerPasses = array_merge($this->compilerPasses, $compilerPasses);
68
69
        return $this;
70
    }
71
72
    public function withConfigFiles(string ...$fileNames): self
73
    {
74
        $this->configFiles = array_merge($this->configFiles, $fileNames);
75
76
        return $this;
77
    }
78
79
    public function compile(): SymfonyContainerBuilder
80
    {
81
        $container = new SymfonyContainerBuilder(new ParameterBag($this->parameters));
82
        array_walk($this->extensions, [$container, 'registerExtension']);
83
84
        $fileLoader = call_user_func($this->fileLoaderFactory, $container);
85
        array_walk(
86
            $this->configFiles,
87
            function (string $fileName) use ($fileLoader) {
88
                $fileLoader->load("$fileName.{$this->fileExtension}");
89
            }
90
        );
91
92
        // array_walk is impossible here because the key will be passed as second parameter
93
        array_map([$container, 'addCompilerPass'], $this->compilerPasses);
94
95
        $container->getCompilerPassConfig()->setRemovingPasses([]);
96
        $container->compile();
97
98
        return $container;
99
    }
100
}
101