Issues (14)

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.

classes/subway-page-redirect.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
 * This file is part of the Subway WordPress Plugin Package.
4
 *
5
 * (c) Joseph Gabito <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * PHP Version 5.4
11
 *
12
 * @category Subway\Page\Redirect
13
 * @package  Subway
14
 * @author   Joseph G. <[email protected]>
15
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
16
 * @version  GIT:github.com/codehaiku/subway
17
 * @link     github.com/codehaiku/subway The Plugin Repository
18
 */
19
20
namespace Subway;
21
22
if (! defined('ABSPATH') ) {
23
    return;
24
}
25
26
/**
27
 * Subway Option Methods.
28
 *
29
 * @category Subway\Page\Redirect
30
 * @package  Subway
31
 * @author   Joseph G. <[email protected]>
32
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
33
 * @link     github.com/codehaiku/subway The Plugin Repository
34
 * @since    1.0
35
 */
36
final class PageRedirect
37
{
38
39
    /**
40
     * Redirects pages into our login page.
41
     *
42
     * @return void.
0 ignored issues
show
The doc-type void. could not be parsed: Unknown type name "void." at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
43
     */
44
    public static function index()
45
    {
46
47
        // Additional filter for custom pages, taxonomy, links, parameterized urls, etc.
48
        // Callback function/method must return true (boolean) to disable redirect.
49
        $should_exit = apply_filters( 'subway/classes/subway-page-redirect/index/before-page-redirect', false );
50
51
        if ( $should_exit ) {
52
            return;
53
        }
54
55
        // Only execute for non logged in users.
56
        if (is_user_logged_in() ) {
57
            return;
58
        }
59
        
60
        $is_private = false;
61
62
        $queried_id = get_queried_object_id();
63
64
        $current_post = get_post(absint($queried_id));
65
66
        $login_page_id = absint(get_option('subway_login_page'));
67
68
        $excluded_page = Options::getPublicPostsIdentifiers();
69
70
        // Already escaped inside 'subway_get_redirect_page_url'.
71
        $redirect_page = Options::getRedirectPageUrl(); // WPCS XSS OK.
72
73
        if ( !empty( $current_post ) ) {
74
		  $is_private = Metabox::isPostPrivate( $current_post->ID );
75
        }
76
77
        // do_action( 'subway/classes/subway-page-redirect/index/before_page_redirect' );
78
79
        // Turn off if is in 'wc-ajax' (woocommerce)
80
        if ( function_exists( 'is_ajax') ) {
81
            if ( is_ajax() ) {
82
               return;
83
            }
84
        }
85
86
        // Same for normal ajax requests.
87
        if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX  ) {
88
            return;
89
        }
90
91
        // Exit if site is public.
92
        if ( Options::isPublicSite() ) {
93
            return;
94
        }
95
96
        // Check if redirect page is empty or not.
97
        if ( empty( $redirect_page ) ) {
98
            return;
99
        }
100
101
        // Check if buddypress activate page.
102
        if (function_exists('bp_is_activation_page') ) {
103
            if (bp_is_activation_page() ) {
104
                return;
105
            }
106
        }
107
108
        // Check if buddypress registration page.
109
        if (function_exists('bp_is_register_page') ) {
110
            if (bp_is_register_page() ) {
111
                return;
112
            }
113
        }
114
115
        // Assign 0 value to empty $post->ID to prevent exception.
116
        // This applies to custom WordPress pages such as BP Members Page and Groups.
117
        if (empty($current_post) ) {
118
            $current_post = new \stdclass;
119
            $current_post->ID = 0;
120
        }
121
122
        $current_page_id = absint($current_post->ID);
123
124
        // Check if $current_page_id && $selected_blog_id is equal to each other.
125
        // Get the page ID instead of global $post->ID that the query returns.
126
        // The ID of the first post object inside the loop is not correct.
127
        $blog_id = absint(get_option('page_for_posts'));
128
129
        if (is_home() ) {
130
            if ($blog_id === $login_page_id ) {
131
                $current_page_id = $blog_id;
132
            }
133
        }
134
135
        // Only execute the script for non-loggedin visitors.
136
        if ( ! is_user_logged_in() ) {
137
138
            if ($current_page_id !== $login_page_id ) {
139
140
                if ( ! in_array( $current_page_id, $excluded_page, true ) || in_array( $current_page_id, $excluded_page, true ) && true === $is_private ) {
141
142
                    wp_safe_redirect(
143
                        add_query_arg(
144
                            array( '_redirected' => 'yes' ),
145
                            $redirect_page
146
                        )
147
                    );
148
149
                    Helpers::close();
150
                }
151
            }
152
        }
153
    }
154
155
}
156