Issues (36)

Security Analysis    not enabled

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.

Compiler/DoctrineCompilerPass.php (2 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
/*
4
 * This file is part of php-cache\cache-bundle package.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\CacheBundle\DependencyInjection\Compiler;
13
14
use Cache\Bridge\Doctrine\DoctrineCacheBridge;
15
use Cache\CacheBundle\Factory\DoctrineBridgeFactory;
16
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
/**
22
 * Add the doctrine bridge around the PSR-6 cache services.
23
 *
24
 * @author Aaron Scherer <[email protected]>
25
 * @author Tobias Nyholm <[email protected]>
26
 */
27
class DoctrineCompilerPass implements CompilerPassInterface
28
{
29
    /**
30
     * @type ContainerBuilder
31
     */
32
    private $container;
33
34
    /**
35
     * @throws \Exception
36
     *
37
     * @return void
38
     */
39 1
    public function process(ContainerBuilder $container)
40
    {
41 1
        $this->container = $container;
42
43
        // If disabled, continue
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44 1
        if (!$this->container->hasParameter('cache.doctrine')) {
45 1
            return;
46
        }
47
48
        if (!$this->hasDoctrine()) {
49
            throw new \Exception(
50
                'Not able to find any doctrine caches to implement. Ensure you have Doctrine ORM or ODM'
51
            );
52
        }
53
54
        $this->enableDoctrineSupport($this->container->getParameter('cache.doctrine'));
55
    }
56
57
    /**
58
     * Loads the Doctrine configuration.
59
     *
60
     * @param array $config A configuration array
61
     *
62
     * @throws InvalidConfigurationException
63
     */
64
    protected function enableDoctrineSupport(array $config)
65
    {
66
        $types = ['entity_managers', 'document_managers'];
67
        // For each ['metadata' => [], 'result' => [], 'query' => []]
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
68
        foreach ($config as $cacheType => $typeConfig) {
69
            foreach ($types as $type) {
70
                if (!isset($typeConfig[$type])) {
71
                    continue;
72
                }
73
74
                // Copy the tagging setting to the $typeConfig
75
                $typeConfig['use_tagging'] = $config['use_tagging'];
76
77
                // Doctrine can't talk to a PSR-6 cache, so we need a bridge
78
                $bridgeServiceId = sprintf('cache.service.doctrine.%s.%s.bridge', $cacheType, $type);
79
                $this->container->register($bridgeServiceId, DoctrineCacheBridge::class)
80
                    ->setPublic(false)
81
                    ->setFactory([DoctrineBridgeFactory::class, 'get'])
82
                    ->addArgument(new Reference($typeConfig['service_id']))
83
                    ->addArgument($typeConfig)
84
                    ->addArgument(['doctrine', $cacheType]);
85
86
                foreach ($typeConfig[$type] as $manager) {
87
                    $doctrineDefinitionId =
88
                        sprintf(
89
                            'doctrine.%s.%s_%s_cache',
90
                            ($type === 'entity_managers' ? 'orm' : 'odm'),
91
                            $manager,
92
                            $cacheType
93
                        );
94
95
                    // Replace the doctrine entity manager cache with our bridge
96
                    $this->container->setAlias($doctrineDefinitionId, $bridgeServiceId);
97
                }
98
            }
99
        }
100
    }
101
102
    /**
103
     * Checks to see if there are ORM's or ODM's.
104
     *
105
     * @return bool
106
     */
107
    private function hasDoctrine()
108
    {
109
        return
110
            $this->container->hasAlias('doctrine.orm.entity_manager') ||
111
            $this->container->hasAlias('doctrine_mongodb.document_manager');
112
    }
113
}
114