Issues (29)

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.

Model/Urls/Fetcher.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
 * A two factor authentication module that protects both the admin and customer logins
4
 * Copyright (C) 2017  Ross Mitchell
5
 *
6
 * This file is part of Rossmitchell/Twofactor.
7
 *
8
 * Rossmitchell/Twofactor is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace Rossmitchell\Twofactor\Model\Urls;
23
24
use Magento\Framework\UrlInterface;
25
26
/**
27
 * Class Fetcher
28
 *
29
 * This is a simple wrapper class around the URL Interface class to give more meaningful names for fetching URLs
30
 */
31
class Fetcher
32
{
33
    const CUSTOMER_AUTHENTICATION_URL = 'twofactor/customerlogin/index';
34
    const CUSTOMER_VERIFICATION_URL = 'twofactor/customerlogin/verify';
35
    const CUSTOMER_ACCOUNT_URL = 'customer/account/index';
36
    const CUSTOMER_LOGIN_URL = 'customer/account/login';
37
38
    const ADMIN_AUTHENTICATION_URL = 'twofactor/adminlogin/index';
39
    const ADMIN_VERIFICATION_URL = 'twofactor/adminlogin/verify';
40
    const ADMIN_DASHBOARD_URL = 'admin/dashboard/index';
41
    const ADMIN_LOGIN_URL = 'admin/index/index';
42
43
    /**
44
     * @var UrlInterface
45
     */
46
    private $url;
47
48
    /**
49
     * Fetcher constructor.
50
     *
51
     * @param UrlInterface $url
52
     */
53 45
    public function __construct(UrlInterface $url)
54
    {
55 45
        $this->url = $url;
56 45
    }
57
58
    /**
59
     * Used to get either the admin or customer two factor authentication URL
60
     *
61
     * @param bool $forAdmin - true for the admin URL, false for the customer URL
62
     * @return string
63
     */
64 22 View Code Duplication
    public function getAuthenticationUrl($forAdmin = false)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
    {
66 22
        if ($forAdmin === true) {
67 5
            return $this->getUrl(self::ADMIN_AUTHENTICATION_URL);
68
        }
69
70 17
        return $this->getUrl(self::CUSTOMER_AUTHENTICATION_URL);
71
    }
72
73
    /**
74
     * Used to get either the admin or customer two factor verification URL
75
     *
76
     * @param bool $forAdmin - true for the admin URL, false for the customer URL
77
     * @return mixed
78
     */
79 19 View Code Duplication
    public function getVerificationUrl($forAdmin = false)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
    {
81 19
        if ($forAdmin === true) {
82 4
            return $this->getUrl(self::ADMIN_VERIFICATION_URL);
83
        }
84
85 15
        return $this->getUrl(self::CUSTOMER_VERIFICATION_URL);
86
    }
87
88
    /**
89
     * Used to get the URL for the customer account page
90
     *
91
     * @return string
92
     */
93 1
    public function getCustomerAccountUrl()
94
    {
95 1
        return $this->getUrl(self::CUSTOMER_ACCOUNT_URL);
96
    }
97
98
    /**
99
     * Used to get the URL for the admin dashboard page
100
     *
101
     * @return string
102
     */
103 3
    public function getAdminDashboardUrl()
104
    {
105 3
        return $this->getUrl(self::ADMIN_DASHBOARD_URL);
106
    }
107
108
    /**
109
     * Used to get the customer login URL
110
     *
111
     * @return string
112
     */
113 1
    public function getCustomerLogInUrl()
114
    {
115 1
        return $this->getUrl(self::CUSTOMER_LOGIN_URL);
116
    }
117
118 2
    public function getAdminLogInUrl()
119
    {
120 2
        return $this->getUrl(self::ADMIN_LOGIN_URL);
121
    }
122
    /**
123
     * This is used to actually get the URL
124
     *
125
     * @param $path
126
     * @return mixed
127
     */
128 27
    private function getUrl($path)
129
    {
130 27
        return $this->url->getUrl($path);
131
    }
132
}
133