Issues (446)

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.

Commons/ResponseObject.inc (6 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
 * Created by:	Marko Kungla @ OkramLabs on Aug 6, 2012 - 9:12:38
4
 * Contact:		[email protected] - https://okramlabs.com
5
 * @copyright:	2015 OkramLabs - https://okramlabs.com
6
 * @license		MIT
7
 *
8
 * Package name: libhowi-filesystem
9
 * @category	 HOWI3
10
 * @package		 libhowi
11
 * @subpackage	 filesystem
12
 * 
13
 * Lang:		PHP
14
 * Encoding:	UTF-8
15
 * File:		ResponseObject.inc
16
 * @link		https://github.com/okramlabs/libhowi-filesystem
17
 ********************************************************************
18
 * Contributors:
19
 * @author		Marko Kungla <[email protected]>
20
 *  	Github:	https://github.com/mkungla
21
 ********************************************************************
22
 * Comments:
23
 *     1. This response trait is adjusted to follow structure of PSR-3. psr/log
24
 *     see - https://github.com/php-fig/log
25
 */
26
namespace HOWI3\libhowi\Filesystem\Commons;
27
28
final class ResponseObject
29
{
30
31
    /**
32
     * Filesystem status
33
     *
34
     * All filesystem methods have true/false states which are stored here
35
     * so it will only change when any messages are logged above minimum loglevel
36
     *
37
     * @var int $status
38
     */
39
    private $status = false;
40
41
    /**
42
     * Last log code
43
     *
44
     * Last logged message code
45
     *
46
     * @var int $code
47
     */
48
    private $code = 0;
49
50
    /**
51
     * Last log message
52
     *
53
     * Defaults to OK and further holds last logged message
54
     *
55
     * @var string $message
56
     */
57
    private $message = 'OK';
58
59
    /**
60
     * Following is optional to have user id and username attached to log
61
     * Following can be anything you want for example your currently logged in
62
     * user info or system user running the script.
63
     *
64
     * @var unknown
65
     */
66
    private $UID = 0;
67
68
    private $username = 'anonymous';
69
70
    private $context;
71
72
    private $level;
73
74
75 731
    public function setStatus($arg)
76
    {
77 731
        $this->status = is_bool($arg) ? $arg : false;
0 ignored issues
show
Documentation Bug introduced by
The property $status was declared of type integer, but is_bool($arg) ? $arg : false is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
78 731
    }
79
80 731
    public function setCode($code)
81
    {
82 731
        $this->code = is_int($code) ? $code : 0;
83 731
    }
84
85 731
    public function setMsg($msg)
86
    {
87 731
        $this->message = is_string($msg) ? $msg : 'BUG';
88 731
    }
89
90 731
    public function setUID($UID)
91
    {
92 731
        $this->UID = is_int($UID) ? $UID : 'BUG';
0 ignored issues
show
Documentation Bug introduced by
It seems like is_int($UID) ? $UID : 'BUG' of type integer or string is incompatible with the declared type object<HOWI3\libhowi\Filesystem\Commons\unknown> of property $UID.

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...
93 731
    }
94
95 731
    public function setUsername($username)
96
    {
97 731
        $this->username = is_string($username) ? $username : 'BUG';
98 731
    }
99
100 731
    public function setTime()
101
    {
102 731
        $this->microtime = microtime(true);
0 ignored issues
show
The property microtime 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...
103 731
    }
104
105 731
    public function setContext($context)
106
    {
107 731
        $this->context = $context;
108 731
    }
109
110 731
    public function setLevel($level)
111
    {
112 731
        $this->level = $level;
113 731
    }
114
115
116 33
    public function getStatus()
117
    {
118 33
        return $this->status;
119
    }
120
121 84
    public function getCode()
122
    {
123 84
        return $this->code;
124
    }
125
126 66
    public function getMsg()
127
    {
128 66
        return $this->message;
129
    }
130
131 3
    public function getUID()
132
    {
133 3
        return $this->UID;
134
    }
135
136 3
    public function getUsername()
137
    {
138 3
        return $this->username;
139
    }
140
141 63
    public function getTime()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
142
    {
143 63
        return $this->microtime;
144
    }
145
146 3
    public function getContext()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
147
    {
148 3
        return $this->context;
149
    }
150
151 3
    public function getLevel()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
152
    {
153 3
        return $this->level;
154
    }
155
}
156