Issues (1131)

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/user/User.class.php (1 issue)

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
namespace Agavi\User;
3
4
// +---------------------------------------------------------------------------+
5
// | This file is part of the Agavi package.                                   |
6
// | Copyright (c) 2005-2011 the Agavi Project.                                |
7
// | Based on the Mojavi3 MVC Framework, Copyright (c) 2003-2005 Sean Kerr.    |
8
// |                                                                           |
9
// | For the full copyright and license information, please view the LICENSE   |
10
// | file that was distributed with this source code. You can also view the    |
11
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
12
// |   vi: set noexpandtab:                                                    |
13
// |   Local Variables:                                                        |
14
// |   indent-tabs-mode: t                                                     |
15
// |   End:                                                                    |
16
// +---------------------------------------------------------------------------+
17
use Agavi\Core\Context;
18
use Agavi\Exception\InitializationException;
19
use Agavi\Util\AttributeHolder;
20
21
/**
22
 * AgaviUser wraps a client session and provides accessor methods for user
23
 * attributes. It also makes storing and retrieving multiple page form data
24
 * rather easy by allowing user attributes to be stored in namespaces, which
25
 * help organize data.
26
 *
27
 * @package    agavi
28
 * @subpackage user
29
 *
30
 * @author     Sean Kerr <[email protected]>
31
 * @copyright  Authors
32
 * @copyright  The Agavi Project
33
 *
34
 * @since      0.9.0
35
 *
36
 * @version    $Id$
37
 */
38
class User extends AttributeHolder
39
{
40
    /**
41
     * @var        Context A Context instance.
42
     */
43
    protected $context = null;
44
45
    /**
46
     * @var        string Storage namespace where user attributes are put.
47
     */
48
    protected $storageNamespace = 'org.agavi.user.User';
49
50
    /**
51
     * Retrieve the current application context.
52
     *
53
     * @return     Context A Context instance.
54
     *
55
     * @author     Sean Kerr <[email protected]>
56
     * @since      0.9.0
57
     */
58
    final public function getContext()
59
    {
60
        return $this->context;
61
    }
62
63
    /**
64
     * Retrieve the Storage namespace
65
     *
66
     * @return     string The Storage namespace
67
     *
68
     * @author     David Zülke <[email protected]>
69
     * @since      0.11.0
70
     */
71
    public function getStorageNamespace()
72
    {
73
        return $this->storageNamespace;
74
    }
75
76
    /**
77
     * Initialize this User.
78
     *
79
     * @param      Context $context An Context instance.
80
     * @param      array   $parameters An associative array of initialization parameters.
81
     *
82
     * @throws     InitializationException If an error occurs while
83
     *                                                 initializing this User.
84
     *
85
     * @author     Sean Kerr <[email protected]>
86
     * @author     David Zülke <[email protected]>
87
     * @since      0.9.0
88
     */
89
    public function initialize(Context $context, array $parameters = array())
90
    {
91
        $this->context = $context;
92
93
        if (isset($parameters['default_namespace'])) {
94
            $this->defaultNamespace = $parameters['default_namespace'];
95
        }
96
        
97
        if (isset($parameters['storage_namespace'])) {
98
            $this->storageNamespace = $parameters['storage_namespace'];
99
        }
100
101
        $this->setParameters($parameters);
102
        
103
        // read data from storage
104
        $this->attributes = $context->getStorage()->read($this->storageNamespace);
0 ignored issues
show
Documentation Bug introduced by
It seems like $context->getStorage()->...this->storageNamespace) of type * is incompatible with the declared type array of property $attributes.

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...
105
106
        if ($this->attributes == null) {
107
            // initialize our attributes array
108
            $this->attributes = array();
109
        }
110
    }
111
112
    /**
113
     * Startup the user.
114
     *
115
     * You'd usually try to auth from a cookie here etc.
116
     *
117
     * @author     David Zülke <[email protected]>
118
     * @since      0.11.0
119
     */
120
    public function startup()
121
    {
122
    }
123
124
    /**
125
     * Execute the shutdown procedure.
126
     *
127
     * @author     Sean Kerr <[email protected]>
128
     * @since      0.9.0
129
     */
130
    public function shutdown()
131
    {
132
        // write attributes to the storage
133
        $this->getContext()->getStorage()->write($this->storageNamespace, $this->attributes);
134
    }
135
}
136