Issues (190)

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.

bundles/lib/Session.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
 * Manage Sessions
5
 *
6
 * @category  	lib
7
 * @author    	Judicaël Paquet <[email protected]>
8
 * @copyright 	Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93)
9
 * @license   	https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël
10
 * @version   	Release: 1.0.0
11
 * @filesource	https://github.com/las93/venus2
12
 * @link      	https://github.com/las93
13
 * @since     	1.0
14
 */
15
namespace Venus\lib;
16
17
/**
18
 * This class manage the Sessions
19
 *
20
 * @category  	lib
21
 * @author    	Judicaël Paquet <[email protected]>
22
 * @copyright 	Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93)
23
 * @license   	https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël
24
 * @version   	Release: 1.0.0
25
 * @filesource	https://github.com/las93/venus2
26
 * @link      	https://github.com/las93
27
 * @since     	1.0
28
 */
29
class Session
30
{	
0 ignored issues
show
The opening class brace should be on a newline by itself.
Loading history...
31
	/**
32
	 * constructor
33
	 *
34
	 * @access public
35
	 * @return \Venus\lib\Session
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
36
	 */
37
	public function __construct()
38
	{	
39
		$this->start();
40
	}
41
	
42
  	/**
43
  	 * set a value
44
  	 *
45
  	 * @access public
46
  	 * @param  string $sName name of the session
47
  	 * @param  mixed $mValue value of this sesion var
48
  	 * @return Session
49
  	 */
50
  	public function set(string $sName, $mValue) : Session
51
	{
52
    	$_SESSION[$sName] = $mValue;
53
    	return $this;
54
  	}
55
56
  	/**
57
  	 * set a value
58
  	 *
59
  	 * @access public
60
  	 * @param  string $sName name of the session
61
  	 * @return mixed
62
  	 */
63
  	public function get(string $sName)
64
	{
65
  		if (isset($_SESSION[$sName])) { return $_SESSION[$sName]; }
66
  		else { return false; }
67
  	}
68
69
  	/**
70
  	 * start the session
71
  	 *
72
  	 * @access public
73
  	 * @return mixed
74
  	 */
75
  	public function start()
76
	{
77
		if (!session_id()) { session_start(); }
78
  	}
79
80
  	/**
81
  	 * set a flashbag value
82
  	 *
83
  	 * @access public
84
  	 * @param  string $sName name of the session
85
  	 * @param  string $sValue value of this sesion var
86
  	 * @return \Venus\lib\Session
87
	 */
88
 	 public function setFlashBag($sName, $sValue)
89
	 {
90
  		if (!isset($_SESSION['flashbag'])) { $_SESSION['flashbag'] = array(); }
91
92
  		$_SESSION['flashbag'][$sName] = $sValue;
93
  		return $this;
94
	}
95
	
96
	/**
97
	 * destroy the session
98
	 *
99
	 * @access public
100
	 * @return mixed
101
	 */
102
	public function destroy()
103
	{
104
		session_start();
105
106
		$_SESSION = array();
107
		
108
		if (ini_get("session.use_cookies")) {
109
		    
110
			$aParams = session_get_cookie_params();
111
		    
112
		    setcookie(session_name(), '', time() - 42000,
113
		        $aParams["path"], $aParams["domain"],
114
		        $aParams["secure"], $aParams["httponly"]
115
		    );
116
		}
117
118
		session_destroy();
119
	}
120
}
121