Issues (4)

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.

AsmTranslationLoaderExtension.php (2 issues)

Labels
Severity

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 Asm\TranslationLoaderBundle\DependencyInjection
4
 */
5
namespace Asm\TranslationLoaderBundle\DependencyInjection;
6
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\Config\FileLocator;
9
use Symfony\Component\DependencyInjection\Reference;
10
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
11
use Symfony\Component\DependencyInjection\Loader;
12
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
13
14
/**
15
 * This is the class that loads and manages your bundle configuration
16
 *
17
 * @package Asm\TranslationLoaderBundle\DependencyInjection
18
 * @author marc aschmann <[email protected]>
19
 * @uses Symfony\Component\DependencyInjection\ContainerBuilder
20
 * @uses Symfony\Component\Config\FileLocator
21
 * @uses Symfony\Component\HttpKernel\DependencyInjection\Extension
22
 * @uses Symfony\Component\DependencyInjection\Loader
23
 */
24
class AsmTranslationLoaderExtension extends Extension
25
{
26
    /**
27
     * {@inheritDoc}
28
     */
29 7
    public function load(array $configs, ContainerBuilder $container)
30
    {
31 7
        $configuration = new Configuration();
32 7
        $config = $this->processConfiguration($configuration, $configs);
33
34 7
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
35 7
        $loader->load('services.yml');
36
37
        // set entity manager for translations
38 7
        $em = 'default';
39 7
        if (isset($config['database']['entity_manager'])
40 7
            && $config['database']['entity_manager'] != 'default'
41 7
        ) {
42
            $em = $config['database']['entity_manager'];
43
        }
44
45
        // association between file extensions and translation loader service ids
46 7
        $container->setParameter('asm_translation_loader.translation_loaders', $config['loaders']);
47 7
        $container->setParameter('asm_translation_loader.database.entity_manager', $em);
48
49 7
        $loader = new XmlFileLoader(
50 7
            $container,
51 7
            new FileLocator(__DIR__.'/../Resources/config')
52 7
        );
53
54
        // load the event dispatcher
55 7
        $loader->load('event_dispatcher.xml');
56
57
        // load the translation manager resource
58 7
        $container->setParameter('asm_translation_loader.resources', $config['resources']);
59 7
        $loader->load('translation_manager_resource.xml');
60
61
        // check if history feature is enabled
62 7
        if (isset($config['history']['enabled']) && true === $config['history']['enabled']) {
63 1
            $loader->load('translation_history_subscriber.xml');
64
65 1
            $definition = $container->getDefinition('asm_translation_loader.history.subscriber');
66
67 1
            if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) {
68 1
                $definition->replaceArgument(1, new Reference('security.token_storage'));
69 1
            } else {
70
                $definition->replaceArgument(1, new Reference('security.context'));
71
            }
72 1
        }
73
74 7
        $container->setParameter('asm_translation_loader.translation_manager.class', $config['translation_manager']);
75 7
        $container->setParameter('asm_translation_loader.translation_history_manager.class', $config['translation_history_manager']);
76 7
        $container->setParameter('asm_translation_loader.model.translation.class', $config['translation_class']);
77 7
        $container->setParameter('asm_translation_loader.model.translation_history.class', $config['translation_history_class']);
78
79 7
        if ('orm' == $config['driver']) {
80 7
            $loader->load('orm.xml');
81
82 7
            $definition = $container->getDefinition('asm_translation_loader.translation.entity_manager');
83
84 7
            if (method_exists('Symfony\Component\DependencyInjection\Definition', 'setFactory')) {
85 7
                $definition->setFactory(array(new Reference('doctrine'), 'getManager'));
86 7
            } else {
87
                $definition->setFactoryService('doctrine');
0 ignored issues
show
The method setFactoryService() does not exist on Symfony\Component\DependencyInjection\Definition. Did you maybe mean setFactory()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
88
                $definition->setFactoryMethod('getManager');
0 ignored issues
show
The method setFactoryMethod() does not exist on Symfony\Component\DependencyInjection\Definition. Did you maybe mean setFactory()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
89
            }
90 7
        }
91
92
        // load the loader resolver service
93 7
        $loader->load('file_loader_resolver.xml');
94 7
    }
95
96
    /**
97
     * {@inheritDoc}
98
     */
99 15
    public function getNamespace()
100
    {
101 15
        return 'https://github.com/maschmann/TranslationLoaderBundle/schema/dic';
102
    }
103
104
    /**
105
     * {@inheritDoc}
106
     */
107 2
    public function getXsdValidationBasePath()
108
    {
109 2
        return __DIR__.'/../Resources/config/schema';
110
    }
111
}
112