Issues (100)

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.

src/DB/DoctrineBootstrap.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
 * DoctrineBootstrap
5
 *
6
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7
 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
8
 *
9
 * Permission is hereby granted to use or copy this program
10
 * for any purpose, provided the above notices are retained on all copies.
11
 * Permission to modify the code and to distribute modified code is granted,
12
 * provided the above notices are retained, and a notice that the code was
13
 * modified is included with the above copyright notice.
14
 *
15
 * @category  Wp
16
 * @package   Punction
17
 * @author    Andrzej Marcinkowski <[email protected]>
18
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
19
 * @license   MIT http://opensource.org/licenses/MIT
20
 * @version   1.0 $Id$ $Format:%H$
21
 * @link      http://
22
 * @since     File available since Release 1.0.0
23
 * PHP Version 5
24
 */
25
namespace Hospitalplugin\DB;
26
27
use Doctrine\ORM\Tools\Setup;
28
use Doctrine\ORM\EntityManager;
29
use Doctrine\ORM\Tools\Console\ConsoleRunner;
30
// php vendor/bin/doctrine orm:schema-tool:update --force --dump-sql
31
32
/**
33
 * DoctrineBootstrap
34
 *
35
 * @category Wp
36
 * @package Punction
37
 * @author Andrzej Marcinkowski <[email protected]>
38
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
39
 * @license MIT http://opensource.org/licenses/MIT
40
 * @version 1.0 $Id$ $Format:%H$
41
 * @link http://
42
 * @since File available since Release 1.0.0
43
 *       
44
 */
45
class DoctrineBootstrap {
46
	
47
	/**
48
	 * entity manager
49
	 *
50
	 * @var _entityManager EnitytManager
51
	 */
52
	private static $_entityManager;
53
	
54
	/**
55
	 * loading envs
56
	 */
57
	private static function _loadEnv() {
58
		if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
59
			return;
60
		}
61
		if (defined ( 'ABSPATH' )) {
62
			\Dotenv::load ( ABSPATH );
63
		} else {
64
			\Dotenv::load ( getenv ( 'HOME' ) );
65
		}
66
	}
67
	private static function getPaths() {
68
		if (file_exists ( getcwd () . "/src/Entities" )) {
69
			return array (
70
					getcwd () . "/src/Entities" 
71
			);
72
		} else {
73
			return array (
74
					getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75
			);
76
		}
77
	}
78
	
79
	/**
80
	 *
81
	 * @return entityManager EntityManager
82
	 */
83
	private static function _getInstance() {
84
		$isDevMode = true;
85
		$config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
		self::_loadEnv ();
87
		$conn = array (
88
				'dbname' => getenv ( 'DB_NAME' ),
89
				'user' => getenv ( 'DB_USER' ),
90
				'password' => getenv ( 'DB_PASSWORD' ),
91
				'host' => getenv ( 'DB_HOST' ),
92
				'driver' => 'pdo_mysql',
93
				'charset' => 'utf8',
94
				'driverOptions' => array (
95
						1002 => 'SET NAMES utf8' 
96
				),
97
				'mapping_types' => 'enum:string' 
98
		);
99
		return EntityManager::create ( $conn, $config );
100
	}
101
	
102
	/**
103
	 * returns enitytManager
104
	 *
105
	 * @return EntityManager
106
	 */
107
	public static function getEntityManager() {
108
		if (self::$_entityManager == null) {
109
			self::$_entityManager = self::_getInstance ();
0 ignored issues
show
Documentation Bug introduced by
It seems like self::_getInstance() of type object<Doctrine\ORM\EntityManager> is incompatible with the declared type object<Hospitalplugin\DB\_entityManager> of property $_entityManager.

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...
110
		}
111
		return self::$_entityManager;
0 ignored issues
show
Bug Compatibility introduced by
The expression self::$_entityManager; of type Doctrine\ORM\EntityManag...lugin\DB\_entityManager adds the type Hospitalplugin\DB\_entityManager to the return on line 111 which is incompatible with the return type documented by Hospitalplugin\DB\Doctri...strap::getEntityManager of type Doctrine\ORM\EntityManager.
Loading history...
112
	}
113
	public static function getCli() {
114
		$em = DoctrineBootstrap::getEntityManager ();
115
		$em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
		return ConsoleRunner::createHelperSet ( $em );
117
	}
118
}
119
120