Issues (8)

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/AppserverIo/Logger/LogMessage.php (4 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
/**
4
 * AppserverIo\Logger\LogMessage
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      http://github.com/appserver-io/logger
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Logger;
22
23
/**
24
 * Thread-Safe log message implemenation.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2015 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      http://github.com/appserver-io/logger
30
 * @link      http://www.appserver.io
31
 */
32
class LogMessage implements LogMessageInterface
33
{
34
35
    /**
36
     * Initializes the message with the necessary information.
37
     *
38
     * @param string $id      The unique-ID of the log message
39
     * @param string $level   The log level
40
     * @param string $message The message to be logged
41
     * @param array  $context The message context
42
     */
43 8
    public function __construct($id, $level, $message, array $context = array())
44
    {
45 8
        $this->id = $id;
0 ignored issues
show
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
46 8
        $this->level = $level;
0 ignored issues
show
The property level does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
47 8
        $this->message = $message;
0 ignored issues
show
The property message does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
48 8
        $this->context = $context;
0 ignored issues
show
The property context does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
49 8
    }
50
51
    /**
52
     * Returns the unique-ID of the log message.
53
     *
54
     *  @return string The unique-ID
55
     */
56
    public function getId()
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * Returns the log level.
63
     *
64
     * @return string The log level
65
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#5-psrlogloglevel
66
     */
67 6
    public function getLevel()
68
    {
69 6
        return $this->level;
70
    }
71
72
    /**
73
     * Returns the message we want to log.
74
     *
75
     * @return string The message to be logged
76
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#12-message
77
     */
78 6
    public function getMessage()
79
    {
80 6
        return $this->message;
81
    }
82
83
    /**
84
     * Returns the context we're logging.
85
     *
86
     * @return array The log context
87
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#13-context
88
     */
89 6
    public function getContext()
90
    {
91 6
        return $this->context;
92
    }
93
94
    /**
95
     * Sets the context we want to log.
96
     *
97
     * @param array $context The log context
98
     *
99
     * @return void
100
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#13-context
101
     */
102
    public function setContext(array $context)
103
    {
104
        $this->context = $context;
105
    }
106
107
    /**
108
     * Merges the values of the passed array into the context.
109
     *
110
     * @param array $toMerge The array with the data to merge
111
     *
112
     * @return void
113
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#13-context
114
     */
115
    public function mergeIntoContext(array $toMerge)
116
    {
117
        $this->context = array_merge($this->context, $toMerge);
118
    }
119
120
    /**
121
     * Appends the passed key/value pair to the context.
122
     *
123
     * @param string $key   The key to merge the value with
124
     * @param mixed  $value The value to merge
125
     *
126
     * @return void
127
     * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#13-context
128
     */
129
    public function appendToContext($key, $value)
130
    {
131
        $this->context[$key] = $value;
132
    }
133
}
134