Issues (34)

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/Services/PasswordResetBrokerManager.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
3
declare(strict_types=1);
4
5
namespace Rinvex\Auth\Services;
6
7
use InvalidArgumentException;
8
use Illuminate\Contracts\Auth\PasswordBrokerFactory;
9
use Rinvex\Auth\Contracts\PasswordResetBrokerContract;
10
11
class PasswordResetBrokerManager implements PasswordBrokerFactory
12
{
13
    /**
14
     * The application instance.
15
     *
16
     * @var \Illuminate\Foundation\Application
17
     */
18
    protected $app;
19
20
    /**
21
     * The array of created "drivers".
22
     *
23
     * @var array
24
     */
25
    protected $brokers = [];
26
27
    /**
28
     * Create a new PasswordResetBroker manager instance.
29
     *
30
     * @param \Illuminate\Foundation\Application $app
31
     */
32
    public function __construct($app)
33
    {
34
        $this->app = $app;
35
    }
36
37
    /**
38
     * Attempt to get the broker from the local cache.
39
     *
40
     * @param string $name
0 ignored issues
show
Should the type for parameter $name not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
41
     *
42
     * @return \Rinvex\Auth\Contracts\PasswordResetBrokerContract
43
     */
44
    public function broker($name = null): PasswordResetBrokerContract
45
    {
46
        $name = $name ?: $this->getDefaultDriver();
47
48
        return $this->brokers[$name] ?? $this->brokers[$name] = $this->resolve($name);
49
    }
50
51
    /**
52
     * Resolve the given broker.
53
     *
54
     * @param string $name
55
     *
56
     * @throws \InvalidArgumentException
57
     *
58
     * @return \Rinvex\Auth\Contracts\PasswordResetBrokerContract
59
     */
60
    protected function resolve($name): PasswordResetBrokerContract
61
    {
62
        $config = $this->getConfig($name);
63
64
        if (is_null($config)) {
65
            throw new InvalidArgumentException("Password resetter [{$name}] is not defined.");
66
        }
67
68
        return new PasswordResetBroker(
69
            $this->app['auth']->createUserProvider($config['provider']),
70
            $this->app['config']['app.key'],
71
            $config['expire']
72
        );
73
    }
74
75
    /**
76
     * Get the password reset broker configuration.
77
     *
78
     * @param string $name
79
     *
80
     * @return array
81
     */
82
    protected function getConfig($name): array
83
    {
84
        return $this->app['config']["auth.passwords.{$name}"];
85
    }
86
87
    /**
88
     * Get the default password reset broker name.
89
     *
90
     * @return string
91
     */
92
    public function getDefaultDriver(): string
93
    {
94
        return $this->app['config']['auth.defaults.passwords'];
95
    }
96
97
    /**
98
     * Set the default password reset broker name.
99
     *
100
     * @param string $name
101
     *
102
     * @return void
103
     */
104
    public function setDefaultDriver($name): void
105
    {
106
        $this->app['config']['auth.defaults.passwords'] = $name;
107
    }
108
109
    /**
110
     * Dynamically call the default driver instance.
111
     *
112
     * @param string $method
113
     * @param array  $parameters
114
     *
115
     * @return mixed
116
     */
117
    public function __call($method, $parameters)
118
    {
119
        return $this->broker()->{$method}(...$parameters);
120
    }
121
}
122