Issues (2)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/SqlSchemaCreator.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Event Sourcing implementation module.
5
 *
6
 * @author  Maksim Masiukevich <[email protected]>
7
 * @license MIT
8
 * @license https://opensource.org/licenses/MIT
9
 */
10
11
declare(strict_types = 1);
12
13
namespace ServiceBus\EventSourcingModule;
14
15
use function Amp\call;
16
use Amp\Promise;
17
use ServiceBus\Storage\Common\DatabaseAdapter;
18
19
/**
20
 * @codeCoverageIgnore
21
 */
22
final class SqlSchemaCreator
23
{
24
    private const FIXTURES = [
25
        /** common fixtures */
26
        '/src/EventStream/Store/schema/extensions.sql'                => false,
27
        /** event streams */
28
        '/src/EventStream/Store/schema/event_store_stream.sql'        => false,
29
        '/src/EventStream/Store/schema/event_store_stream_events.sql' => false,
30
        '/src/EventStream/Store/schema/indexes.sql'                   => true,
31
        /** snapshots */
32
        '/src/Snapshots/Store/schema/event_store_snapshots.sql'       => false,
33
        '/src/Snapshots/Store/schema/indexes.sql'                     => true,
34
        /** indexer */
35
        '/src/Indexes/Store/schema/event_sourcing_indexes.sql'        => false,
36
    ];
37
38
    /**
39
     * @var DatabaseAdapter
40
     */
41
    private $adapter;
42
43
    /**
44
     * @var string
45
     */
46
    private $rootDirectoryPath;
47
48
    /**
49
     * @param DatabaseAdapter $adapter
50
     * @param string          $rootDirectoryPath
51
     */
52
    public function __construct(DatabaseAdapter $adapter, string $rootDirectoryPath)
53
    {
54
        $this->adapter           = $adapter;
55
        $this->rootDirectoryPath = \rtrim($rootDirectoryPath, '/');
56
    }
57
58
    /**
59
     * Import fixtures.
60
     *
61
     * @return Promise
62
     */
63
    public function import(): Promise
64
    {
65
        /** @psalm-suppress InvalidArgument Incorrect psalm unpack parameters (...$args) */
66
        return call(
67
            function(array $fixtures): \Generator
68
            {
69
                /**
70
                 * @var string $filePath
71
                 * @var bool   $multipleQueries
72
                 */
73
                foreach ($fixtures as $filePath => $multipleQueries)
74
                {
75
                    $filePath = $this->rootDirectoryPath . $filePath;
76
77
                    $queries = true === $multipleQueries
78
                        ? \array_map('trim', \file($filePath))
0 ignored issues
show
It seems like file($filePath) can also be of type false; however, parameter $arr1 of array_map() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

78
                        ? \array_map('trim', /** @scrutinizer ignore-type */ \file($filePath))
Loading history...
79
                        : [(string) \file_get_contents($filePath)];
80
81
                    foreach ($queries as $query)
82
                    {
83
                        if ('' !== $query)
84
                        {
85
                            /** @psalm-suppress TooManyTemplateParams Wrong Promise template */
86
                            yield $this->adapter->execute($query);
87
                        }
88
                    }
89
                }
90
            },
91
            self::FIXTURES
92
        );
93
    }
94
}
95