Issues (2)

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/Native/Facades/InputSanitizer.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
 * Part of the InputSanitizer package.
5
 *
6
 * @package        InputSanitizer
7
 * @version        1.0.2
8
 * @author         Arthur Lorent <[email protected]>, Daniel Lucas <[email protected]>
9
 * @license        MIT
10
 * @copyright  (c) 2006-2017, ACID-Solutions SARL
11
 * @link           https://acid.fr
12
 */
13
14
namespace AcidSolutions\InputSanitizer\Native\Facades;
15
16
use AcidSolutions\InputSanitizer\Native\InputSanitizerBootstrapper;
17
18
class InputSanitizer
19
{
20
    /**
21
     * The InputSanitizer instance.
22
     *
23
     * @var \AcidSolutions\InputSanitizer\InputSanitizer
24
     */
25
    protected $inputSanitizer;
26
    /**
27
     * The Native BootStrapper instance.
28
     *
29
     * @var InputSanitizerBootstrapper
30
     */
31
    protected static $instance;
32
33
    /**
34
     * Constructor.
35
     *
36
     * @param InputSanitizerBootstrapper $bootstrapper
37
     */
38 8
    public function __construct(InputSanitizerBootstrapper $bootstrapper = null)
39
    {
40 8
        if ($bootstrapper === null) {
41 6
            $bootstrapper = new InputSanitizerBootstrapper;
42 6
        }
43
44 8
        $this->inputSanitizer = $bootstrapper->createInputSanitizer();
45 8
    }
46
47
    /**
48
     * Returns the InputSanitizer instance.
49
     *
50
     * @return \AcidSolutions\InputSanitizer\InputSanitizer
51
     */
52 6
    public function getInputSanitizer()
53
    {
54 6
        return $this->inputSanitizer;
55
    }
56
57
    /**
58
     * Creates a new Native Bootstrapper instance.
59
     *
60
     * @param InputSanitizerBootstrapper $bootstrapper
61
     *
62
     * @return void
63
     */
64 4
    public static function instance(InputSanitizerBootstrapper $bootstrapper = null)
65
    {
66 4
        if (static::$instance === null) {
67 2
            static::$instance = new static($bootstrapper);
0 ignored issues
show
Documentation Bug introduced by
It seems like new static($bootstrapper) of type this<AcidSolutions\Input...Facades\InputSanitizer> is incompatible with the declared type object<AcidSolutions\Inp...tSanitizerBootstrapper> of property $instance.

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...
68 2
        }
69
70 4
        return static::$instance;
71
    }
72
73
    /**
74
     * Handle dynamic, static calls to the object.
75
     *
76
     * @param string $method
77
     * @param array  $args
78
     *
79
     * @return mixed
80
     */
81 2
    public static function __callStatic($method, $args)
82
    {
83 2
        $instance = static::instance()->getInputSanitizer();
0 ignored issues
show
The method getInputSanitizer does only exist in AcidSolutions\InputSanit...\Facades\InputSanitizer, but not in AcidSolutions\InputSanit...utSanitizerBootstrapper.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
84 2
        switch (count($args)) {
85 2
            case 1:
86 2
                return $instance->{$method}($args[0]);
87
88 2
            case 2:
89 2
                return $instance->{$method}($args[0], $args[1]);
90
91 2
            case 3:
92 2
                return $instance->{$method}($args[0], $args[1], $args[2]);
93
94 2
            default:
95 2
                return call_user_func_array([$instance, $method], $args);
96 2
        }
97
    }
98
}
99