Issues (32)

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/DI/UserBundleExtension.php (9 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 SixtyEightPublishers\User\DI;
6
7
use ArrayObject;
8
use Nette\Schema\Expect;
9
use Nette\Schema\Schema;
10
use Nette\DI\CompilerExtension;
11
use Nette\PhpGenerator\ClassType;
12
use SixtyEightPublishers\User\Common\DI\CommonExtension;
13
use SixtyEightPublishers\User\Authentication\DI\AuthenticationExtension;
14
use SixtyEightPublishers\User\Common\Exception\StopPropagationException;
15
use SixtyEightPublishers\User\ForgotPassword\DI\ForgotPasswordExtension;
16
use SixtyEightPublishers\DoctrineBridge\DI\DatabaseTypeProviderInterface;
17
use SixtyEightPublishers\DoctrineBridge\DI\TargetEntityProviderInterface;
18
use SixtyEightPublishers\DoctrineBridge\DI\EntityMappingProviderInterface;
19
use SixtyEightPublishers\TranslationBridge\DI\TranslationProviderInterface;
20
use SixtyEightPublishers\User\DoctrineIdentity\DI\DoctrineIdentityExtension;
21
22
final class UserBundleExtension extends CompilerExtension implements DatabaseTypeProviderInterface, EntityMappingProviderInterface, TargetEntityProviderInterface, TranslationProviderInterface
23
{
24
	/** @var \Nette\DI\CompilerExtension[] */
25
	private $extensions;
26
27
	public function __construct()
28
	{
29
		$this->extensions = [
0 ignored issues
show
Documentation Bug introduced by
It seems like array('common' => new \S...henticationExtension()) of type array<string,object<Sixt...enticationExtension>"}> is incompatible with the declared type array<integer,object<Nette\DI\CompilerExtension>> of property $extensions.

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...
30
			'common' => new CommonExtension(),
31
			'doctrine_identity' => new DoctrineIdentityExtension(),
32
			'forgot_password' => new ForgotPasswordExtension(),
33
			'authentication' => new AuthenticationExtension(),
34
		];
35
	}
36
37
	/**
38
	 * {@inheritDoc}
39
	 */
40
	public function getConfigSchema(): Schema
41
	{
42
		return Expect::structure(array_map(static function (CompilerExtension $extension) {
43
			return $extension->getConfigSchema();
44
		}, $this->extensions));
45
	}
46
47
	/**
48
	 * {@inheritDoc}
49
	 */
50
	public function loadConfiguration(): void
51
	{
52
		$config = $this->config;
53
		$sharedData = new ArrayObject();
54
55
		foreach ($config as $extName => $extConfig) {
56
			$extension = $this->extensions[$extName];
57
			$extension->setCompiler($this->compiler, $this->prefix($extName));
58
			$extension->setConfig($extConfig);
59
60
			if ($extension instanceof CompilerExtensionPassInterface) {
61
				$extension->attach($this, $sharedData);
62
			}
63
		}
64
65
		foreach ($this->extensions as $name => $extension) {
66
			try {
67
				if ($extension instanceof CompilerExtensionPassInterface) {
68
					$extension->startup();
69
				}
70
			} catch (StopPropagationException $e) {
71
				unset($this->extensions[$name]);
72
73
				continue;
74
			}
75
76
			$extension->loadConfiguration();
77
		}
78
	}
79
80
	/**
81
	 * {@inheritDoc}
82
	 */
83
	public function beforeCompile(): void
84
	{
85
		foreach ($this->extensions as $extension) {
86
			$extension->beforeCompile();
87
		}
88
	}
89
90
	/**
91
	 * {@inheritDoc}
92
	 */
93
	public function afterCompile(ClassType $class): void
94
	{
95
		foreach ($this->extensions as $extension) {
96
			$extension->afterCompile($class);
97
		}
98
	}
99
100
	/**
101
	 * {@inheritDoc}
102
	 */
103 View Code Duplication
	public function getDatabaseTypes(): array
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
104
	{
105
		return array_merge([], ...array_map(static function (DatabaseTypeProviderInterface $provider) {
106
			return $provider->getDatabaseTypes();
107
		}, array_filter(array_values($this->extensions), static function ($extension) {
108
			return $extension instanceof DatabaseTypeProviderInterface;
0 ignored issues
show
The class SixtyEightPublishers\Doc...seTypeProviderInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
109
		})));
110
	}
111
112
	/**
113
	 * {@inheritDoc}
114
	 */
115 View Code Duplication
	public function getEntityMappings(): array
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
116
	{
117
		return array_merge([], ...array_map(static function (EntityMappingProviderInterface $provider) {
118
			return $provider->getEntityMappings();
119
		}, array_filter(array_values($this->extensions), static function ($extension) {
120
			return $extension instanceof EntityMappingProviderInterface;
0 ignored issues
show
The class SixtyEightPublishers\Doc...appingProviderInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
121
		})));
122
	}
123
124
	/**
125
	 * {@inheritDoc}
126
	 */
127 View Code Duplication
	public function getTargetEntities(): array
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
128
	{
129
		return array_merge([], ...array_map(static function (TargetEntityProviderInterface $provider) {
130
			return $provider->getTargetEntities();
131
		}, array_filter(array_values($this->extensions), static function ($extension) {
132
			return $extension instanceof TargetEntityProviderInterface;
0 ignored issues
show
The class SixtyEightPublishers\Doc...EntityProviderInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
133
		})));
134
	}
135
136
	/**
137
	 * {@inheritDoc}
138
	 */
139 View Code Duplication
	public function getTranslationResources(): array
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
140
	{
141
		return array_merge([], ...array_map(static function (TranslationProviderInterface $provider) {
142
			return $provider->getTranslationResources();
143
		}, array_filter(array_values($this->extensions), static function ($extension) {
144
			return $extension instanceof TranslationProviderInterface;
0 ignored issues
show
The class SixtyEightPublishers\Tra...lationProviderInterface does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
145
		})));
146
	}
147
}
148